From 0dd245c21c26489fef58ed7cf210ec4f553512ed Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 10 Oct 2022 14:00:37 +0100 Subject: [PATCH] Remove dragged component from consideration of drop target --- packages/client/src/components/preview/DNDHandler.svelte | 4 +++- packages/client/src/stores/screens.js | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/client/src/components/preview/DNDHandler.svelte b/packages/client/src/components/preview/DNDHandler.svelte index df36d7cb85..8dd9a666bf 100644 --- a/packages/client/src/components/preview/DNDHandler.svelte +++ b/packages/client/src/components/preview/DNDHandler.svelte @@ -183,7 +183,9 @@ // Find the next valid component to consider dropping over, ignoring nested // block components - const component = e.target?.closest?.(".component:not(.block)") + const component = e.target?.closest?.( + `.component:not(.block):not(.${sourceId})` + ) if (component && component.classList.contains("droppable")) { targetInfo = { id: component.dataset.id, diff --git a/packages/client/src/stores/screens.js b/packages/client/src/stores/screens.js index 69dcf99b07..7419e24a53 100644 --- a/packages/client/src/stores/screens.js +++ b/packages/client/src/stores/screens.js @@ -46,8 +46,7 @@ const createScreenStore = () => { // Insert DND placeholder if required const { dndParent, dndIndex, selectedComponentId } = $builderStore - const insert = true - if (insert && activeScreen && dndParent && dndIndex != null) { + if (activeScreen && dndParent && dndIndex != null) { // Remove selected component from tree let selectedParent = findComponentParent( activeScreen.props,