I am currently developing my own custom Drupal plugin and I recently reviewed the code provided in the API for change events:
editor.on('change', function (evt) {
console.log(this.getData());
});
Using this code snippet, I am able to view all the data within my editor when changes are made. My content is organized using custom HTML tags, each with unique data attributes. My primary query revolves around identifying the closest tags when a user adds new content, so that I can append a data attribute to signify that changes have been made.
Additionally, I am looking for a way to implement a timer or delay function to prevent the trigger from occurring with every keystroke. Do you have any suggestions on how best to achieve this?