Remove dragged component from consideration of drop target

This commit is contained in:
Andrew Kingston 2022-10-10 14:00:37 +01:00
parent 73a206e2f1
commit e90a79257f
2 changed files with 4 additions and 3 deletions

View File

@ -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,

View File

@ -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,