-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[Bug]: Mod-z Not Blocked When editor.isEditable Is False #5547
Comments
I also tried the following quickfix. But strangely the Mod-z function is only called when the isEditable is true.
|
I can also reproduce the bug. Just tried it out in my application. Can anyone have a look on this one? |
Maybe this is a browser default behavior? I wonder if the element is still a contenteditable when editable=false |
I can also reproduce the bug. @nperez0111 In my case, the content is initially set to editable=false. I however change the content programmatically. In this case everything works fine. CTRL + Z doesn't change the content back. Only, when I make the content editable and then make it read-only again, the bug occurs. I personally do not think it is the browser's default behaviour, because the bug is only limited to CTRL + Z, but not CTRL + Shift + Z. I tried to pinpoint the cause, but my knowledge of the inner workings of tiptap is unfortunately limited. Could maybe someone investigate this issue? This is unfortunately a severe problem for my application. Thank you! |
Any updates on this one? |
Feel free to look into it and contribute a PR fixing it. |
Thank you @nperez0111. I have already looked into the potential causes but haven't found a solution yet. I will give it another try over the weekend. |
Unfortunately, I was unable to identify the root cause. As a temporary "fix" you can use the following code to clear the history whenever you programmatically set the editor to read-only again. This is definitely not the best solution, rather a dirty quickfix for production applications.
|
Affected Packages
core, react, @tiptap/extension-history
Version(s)
2.6.6
Bug Description
However, this only happens for Undo but not for Redo.
Reproduce
I was also able to reproduce it by slightly adjusting the minimal setup: https://tiptap.dev/docs/examples/basics/minimal-setup
You just need to edit some content and click the button to experience the bug for yourself.
Thank you very much in advance for your help!
Browser Used
Chrome
Code Example URL
No response
Expected Behavior
Mod + Z shouldn't change the content when the editor is read-only.
Additional Context (Optional)
No response
Dependency Updates
The text was updated successfully, but these errors were encountered: