Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pasteRulesPlugin always adding one extra character to text range #2968

Merged
merged 1 commit into from
Aug 22, 2022

Conversation

Billiam
Copy link
Contributor

@Billiam Billiam commented Jul 8, 2022

This is a fix for #2939

PasteRule's appendTransaction plugin method looks for a changed range by comparing the before/after state using findDiffStart and findDiffEnd.

The range is passed to state.doc.nodesBetween and then node.textBetween. findDiffStart/end appear to handle node positions differently.

This is already accounted for in the from argument (using Math.max(from - 1, 0)), but there was no such offset for to, so all paste rules receive one extra character at the end, unless the content was pasted at the end of a node (so this also can't be solved in userspace easily).

@netlify
Copy link

netlify bot commented Jul 8, 2022

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit b79520f
🔍 Latest deploy log https://app.netlify.com/sites/tiptap-embed/deploys/62c875ed437bc0000888caf5
😎 Deploy Preview https://deploy-preview-2968--tiptap-embed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@bdbch bdbch merged commit 18336a8 into ueberdosis:main Aug 22, 2022
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.

2 participants