Check if the text has changed compared to a saved state

Hello,

is there a quick way to check if the text has changed compared to a saved state?

txtEditor.on(“change”, …) gives this result compared to the previous state, but I need to know this info compared to a saved state (for example: so to check if the current document has been modified before opening a new one)

thanks
P

You can set an unchanged flag when you save, and then clear it in the 'change' event handler.