Skip to content

Conversation

matthewlipski
Copy link
Collaborator

@matthewlipski matthewlipski commented Feb 17, 2025

This PR fixes an issue with block drag & drop that was introduced in PR #1413. The code block

if (this.isDragOrigin && !this.pmView.dom.contains(event.target as Node)) {
  setTimeout(() => this.pmView.dispatch(this.pmView.state.tr.deleteSelection()), 0);
}

is supposed to check if the dragged blocks come from the same editor instance as the handler, but are being dropped in a different editor instance. This is wrong as !this.pmView.dom.contains(event.target as Node) can be any element outside the current editor instance, and not necessarily another editor.

And so, all that ends up happening when a drop event occurs outside the current editor instance is that the selection is deleted.

Closes #1396
Closes #1435

Copy link

vercel bot commented Feb 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
blocknote ✅ Ready (Inspect) Visit Preview Feb 19, 2025 4:01pm
blocknote-website ✅ Ready (Inspect) Visit Preview Feb 19, 2025 4:01pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blocks disappearing After dnd of a custom block, the editor sometimes loses the block or changes its data unexpectedly.

3 participants