Update state/view after changing doc


With an external JS-event, I changed the innerHTML of #content (with other words: I changed the doc), but however: I cannot see the changed content in the View. What am I missing?

I tried to update the view afterwards by using ‘view.updateState(viewState)’, but this seems not to be the solution… Am I forget something, or am I doing some illegal action?

Here is the code:

let viewState = EditorState.create({
    doc: DOMParser.fromSchema(schema).parse(document.querySelector("#content")),
    plugins: ...
let view = new EditorView(document.querySelector("#editor"), {
    state: viewState


That’s not supported – go through ProseMirror if you want to change its content. It may in some cases work, but not always.