How to handle "select" + "backspace"/"delete"/"cut"/"type" kind of events? "handleTextInput" or "handleDOMEvents.input" doesn't help

First of all, thanks for the amazing library! It saved me so much time during the development.

As for the problem: I got stuck, since I’m trying to track every change in the editor to match its content against a predefined list of tags and replace the text with the matched tags. I use handleDrop, handlePaste and handleDOMEvents.input for these purposes. I also run matching algorithm on external element click and on a “close” icon click that is located inside a tag. The issue is that handleDOMEvents.input fires almost on every event except when I select the text and delete it somehow - either by Backspace, Delete, entering new letter, pasting something or cutting.

  1. Shouldn’t input event also be fired in these scenarios?
  2. How to overcome this situation? Maybe use dispatchTransaction and react to that instead? Or am I missing something?

P.S. Just noticed that “undo” and “redo” commands are not firing “input” event also.

Tracking changes is best done on the level of transactions, not input events. See for example the change tracking example, which keeps a data structure in plugin state and updates it as appropriate when transactions happen.

Thanks, It indeed suits better!