[6.x] Prevent bogus content when dragging inside a node-selected Bard set - #15049
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request fixes an issue where dragging a Grid row inside a Bard set could dump a copy of the set's content into the editor as a table.
This was happening because clicking a non-interactive area inside a set makes ProseMirror node-select it (the blue border). That node selection is backed by a real DOM selection spanning the whole set, which ProseMirror hides visually — so when you drag from anywhere inside the set (like a Grid row's drag handle), the browser starts a native drag of that invisible selection instead of the row sort. And since ProseMirror ignores
dragstartevents originating inside node views, the drag data ends up being the set's raw HTML, meaning Bard parses the Grid's<table>markup into an actual table node on drop.This PR fixes it by preventing native
dragstartevents that originate inside the set while the document selection covers the whole set. Drags of genuinely draggable elements (like Bard images, or nested sets via their drag handles) are unaffected, as is dragging the set itself using its own drag handle.Fixes #14920