Fix/issue 7647 node view selection update#7691
Open
emrullahtastan wants to merge 5 commits intoueberdosis:mainfrom
Open
Fix/issue 7647 node view selection update#7691emrullahtastan wants to merge 5 commits intoueberdosis:mainfrom
emrullahtastan wants to merge 5 commits intoueberdosis:mainfrom
Conversation
… in React and Vue renderers
…-view-selection-update
…and vue-3 packages
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🦋 Changeset detectedLatest commit: 996b516 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 |
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
This PR fixes an issue where custom node views (in both Vue 3 and React) were incorrectly marked as "selected" (receiving the .ProseMirror-selectednode class) whenever they were part of a TextSelection or AllSelection (e.g., Cmd+A).
Implementation Approach
I refined the handleSelectionUpdate method in both VueNodeViewRenderer and ReactNodeViewRenderer. The updated logic now specifically checks if the current editor selection is an instance of NodeSelection and if its position exactly matches the node's position.
Additionally, this PR adopts the recent currentPos lifecycle improvements from upstream/main to ensure safer and more performant position tracking during selection updates.
Testing Done
Manual Testing (Vue 3): Verified with CustomParagraph and Images demos. Cmd+A no longer triggers erroneous selection borders, while direct clicks on images correctly trigger NodeSelection.
Manual Testing (React): Verified identical behavior in the React Images demo.
Conflict Resolution: Successfully merged and tested with the latest upstream/main changes.
Verification Steps
Open a demo with custom node views (e.g., Examples/Images/Vue).
Press Cmd+A to select all.
Expected: Text is highlighted, but the image does NOT receive a selection border/style.
Click directly on the image.
Expected: The image DOES receive a selection border (standard NodeSelection still works).
Additional Notes
The fix addresses the regression reported in issue #7647 while maintaining compatibility with the latest internal position-checking mechanisms introduced in recent Tiptap updates.
Checklist
Related Issues
Fixes #7647