Merge pull request #5745 from ueberdosis/update-editable-on-re-render

fix(react): preserve editable option across renders
This commit is contained in:
Armando Guarino 2024-10-21 16:51:28 +02:00 committed by GitHub
commit 4cb6f98946
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
"@tiptap/react": patch
---
preserve editable option across re-renders #5547

View File

@ -199,7 +199,10 @@ class EditorInstanceManager {
if (this.editor && !this.editor.isDestroyed && deps.length === 0) {
// if the editor does exist & deps are empty, we don't need to re-initialize the editor
// we can fast-path to update the editor options on the existing instance
this.editor.setOptions(this.options.current)
this.editor.setOptions({
...this.options.current,
editable: this.editor.isEditable,
})
} else {
// When the editor:
// - does not yet exist