-
I need to to replace the editor content with a new one. I tried setting I also tried using the const newValue = JSON.parse(val) as any[]
editorValue.current.forEach((_, i) => {
Transforms.removeNodes(editor, { at: [i] })
})
newValue.forEach((node, i) => {
Transforms.insertNodes(editor, node, { at: [i] })
}) but i get the error: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
not sure if this is the "proper" way, but it seems to have worked during my testing.
|
Beta Was this translation helpful? Give feedback.
-
I managed to do it in this way: editor.replaceContent = newContent => {
editor.children = newContent
editor.normalizeNode([editor, []])
} |
Beta Was this translation helpful? Give feedback.
-
Hello, I am also facing a similar situation to replace the editor's content but I am not able to do with this solution. I have my |
Beta Was this translation helpful? Give feedback.
I managed to do it in this way: