It is not a bug, but there is no Question Issue.
The question is: How can I listen for an event 'mention added' or something like that? I need to know when a mention is added. How can I achieve that?
Hi @hpivanov , you can start with code like this:
editor.conversion.for( 'downcast' ).add( dispatcher => {
dispatcher.on( 'attribute:mention', ( evt, data, conversionApi ) => {
console.log( 'Mention has been inserted' );
console.log( data );
}, { priority: 'low' } );
} );
This will be fired every time you insert a mention, or some other content which has mention attribute in the model. If you need some more info, please refer to docs on:
Hope that helps!
This works, but it fires even when I get the data from the editor using getData(). I just need to know that I have clicked on an item from the dropdown menu, that's it.
@hpivanov, in this case, you can simply add a dispatcher for editingDowncast, instead of downcast (which is for editing and data pipelines).
@Mgsy Thanky you. That is what I was looking for :)