fix(react): preserve editable option across renders

This commit is contained in:
Armando Guarino 2024-10-21 16:33:31 +02:00
parent ffb51d3b7e
commit 304eedb769
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