There are a few contexts in which we've thrown around the idea of attaching an onDocumentTransact listener that goes through the inserted/deleted data in each transaction and checks if a node of a certain type was added/removed:
- Reference list updates (which currently happen on every transaction IIRC)
- Adapting VE-MW to @dchan's metadata patch (specifically, to update the model of which categories are on the page and in what order)
- Something about images that @Jdforrester-WMF mumbled in my general direction
Do we think it makes sense to have a core DM feature that does something like the following?
this.document.on( 'transact', function ( tx ) { for each operation { for each inserted or deleted data item { this.emit( 'itemModified', item.type ); } } } );
Or perhaps something that maintains its own set of listeners so that we can skip this if we know there aren't any?
Thoughts?