mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-06-13 13:13:12 +08:00
fix(react): preserve editable option across renders
This commit is contained in:
parent
ffb51d3b7e
commit
304eedb769
5
.changeset/loud-maps-work.md
Normal file
5
.changeset/loud-maps-work.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@tiptap/react": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
preserve editable option across re-renders #5547
|
@ -199,7 +199,10 @@ class EditorInstanceManager {
|
|||||||
if (this.editor && !this.editor.isDestroyed && deps.length === 0) {
|
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
|
// 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
|
// 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 {
|
} else {
|
||||||
// When the editor:
|
// When the editor:
|
||||||
// - does not yet exist
|
// - does not yet exist
|
||||||
|
Loading…
Reference in New Issue
Block a user