Is updating the state using dispatch and updating text using Jquery same?

are these both similar? if not what is the difference?

  1. view.dispatch(view.state.update({changes: …})
  2. document.querySelectorAll(“.cm-content”).innerText = “<…>”

No. One updates the content through the appropriate channel, the other is doing something entirely unsupported that just happens to also have the effect of updating the editor content, but in the process clears any information the editor has (selection, linting, parse tree, etc) about the content.

1 Like