replacing entire document text

Ah, thank you so much, I will try that. My approach is based on from the recommendation here: CodeMirror 6: Setting the contents of the editor, which I couldn’t find when I originally posted. If it’s the case that document nodes don’t have a length property, I wonder how it is that this works most of the time, and only fails intermittently?

Thank you for the quick response, and for maintaining this useful tool.