fix(drag-handle): support RTL direction for drag ghost image#7629
Open
wbcoder0 wants to merge 3 commits intoueberdosis:mainfrom
Open
fix(drag-handle): support RTL direction for drag ghost image#7629wbcoder0 wants to merge 3 commits intoueberdosis:mainfrom
wbcoder0 wants to merge 3 commits intoueberdosis:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 36a39af The changes in this PR will be included in the next version bump. This PR includes changesets to release 72 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
added 2 commits
March 20, 2026 17:51
- Set wrapper dir from dragged block (domAtPos) for mixed RTL/LTR content - Use wrapper bounding rect for setDragImage hotspot (pointer-aligned preview)
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.
Changes Overview
Fix drag ghost (
setDragImage) for RTL editors and mixed-direction blocks: the temporary wrapper now mirrors the dragged block’s text direction, and the drag hotspot is aligned to the pointer using the wrapper’s bounds (not a fixed corner).Implementation Approach
Direction on the ghost wrapper
Resolve the DOM node at the drag range start (
view.domAtPos), normalize text nodes to theirparentElement, then readgetComputedStyle(...).direction(falling back toview.dom). Setwrapper’sdirso the clone matches the block (including RTL page + LTR paragraph cases).Drag image hotspot
DataTransfer.setDragImageuses the off-screenwrapperas the image. After cloning andappend, measurewrapper.getBoundingClientRect()and set the hotspot x toclientX - wrapperRect.left, clamped to[0, wrapperRect.width], so the ghost tracks the cursor in both LTR and RTL.Testing Done
directiondiffers fromview.dom.Verification Steps
dir="rtl"(or CSSdirection: rtl).dir="auto"or LTR block inside RTL editor — ghost should follow the block direction.Additional Notes
diron the editor root and usedoffsetWidthas the hotspot, which mis-handled mixed-direction content and mis-aligned the ghost.