Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/click-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ export class ClickStrategy<K> implements Strategy {
element.addEventListener('click', async () => {
const node = create()

await this.editor.addNode(node)
const added = await this.editor.addNode(node)

if (!added) {
console.warn('Node addition prevented:', node)
return
}

const viewportCenter = this.getViewportCenter()
const view = this.area.nodeViews.get(node.id)
Expand Down
7 changes: 6 additions & 1 deletion src/drop-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ export class DropStrategy<K> implements Strategy {
}

private async drop(node: BaseSchemes['Node'], position: Position) {
await this.editor.addNode(node)
const added = await this.editor.addNode(node)

if (!added) {
console.warn('Node addition prevented:', node)
return
}

const view = this.area.nodeViews.get(node.id)

Expand Down
Loading