I am writing my own plugin for Drupal. I checked the following code in the API for the change events:
editor.on('change', function (evt) {
console.log(this.getData());
});
With it, I can see all the data in my editor when changed. I have my content structured with custom HTML tags (which have some data attributes). My question is, if the user writes some content, how can I get the closest tags - and therefore add a data attribute that it has been changed?
I'd also need some kind of timer/delay, to not trigger that on every keystroke, I suppose?