-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Paste still broken (2.0.0-beta.120) #2003
Comments
Ah, sorry for these issues. We definitely need to add some tests for these paste rules. I know what is happening in the first gif. Because it’s already italic from the first paste, italic can’t applied a second time. But that is something I can fix. But note that the second The second gif shows a different issue. I would really like to know the config of your pasteRules because there seems to be a data loss. Can you share some code or provide a codesandbox with that config? |
No problem! Here's a small repro project for the data loss: https://codesandbox.io/s/tiptap-after-paste-bug2-dataloss-dqq63?file=/src/App.vue The changes: I added a "quickbold" extension to make bold work with just a single star e.g. const starInputRegex = /(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/gm;
// export const starPasteRegex = /(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/gm;
export const starPasteRegex = /(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/gm
export const QuickBold = Bold.extend({
addInputRules() {
return [markInputRule({ find: starInputRegex, type: this.type })];
},
addPasteRules() {
return [markPasteRule({ find: starPasteRegex, type: this.type })];
},
}); To reproduce:
Expected: The "i" is lost after pressing Enter. |
Good insight! :) |
found the issue. there is no issue with paste rules but with some input rule regex. input rule regex should not have the |
What’s the bug you are facing?
Pasting things like
**bold**
or*italic*
multiple times doesn't work anymore.How can we reproduce the bug on our side?
See updated https://codesandbox.io/s/tiptap-after-paste-bug-jjoxc and bug #2002 that still reproduces.
Broken paste in above codesandbox (click to play gif):
And in my project. Note: In my project I have a bit different settings than bold/italic from StarterKit, however used to work before. Not there's data loss, same as bug #2002 (click to play gif)
Can you provide a CodeSandbox?
https://codesandbox.io/s/tiptap-after-paste-bug-jjoxc
What did you expect to happen?
Paste to work without extra characters or losing data.
Anything to add? (optional)
No response
Did you update your dependencies?
Are you sponsoring us?
The text was updated successfully, but these errors were encountered: