How to detect editor content has changed?

Is there some simple way to check if editor content has changed from the original?

I’d like to provide the user a button that will work only when user has typed in some changes. But again disable that button if user undos until the content is what it was at the beginning.

Since documents are a persistent data structure, you can just keep a reference to the original document, and test originalDoc.eq(view.state.doc) to know whether the document in the view is equal to the original. (Because common substructure is shared, this isn’t all that expensive.) Does that help?

1 Like

Thanks, it works