I'm having trouble finding this in the documentation, although I believe this exists- is there an event which is fired when a user removes a widget? I need to handle this event in order to prompt the user to confirm deletion, and once confirmed, syncronize to a back-end. Currently I am implementing this by having a separate plugin that listens to the "change" event and registering widgets within my own plugin, but that is obviously bad design. Could someone post a link to the appropriate place in the documentation?
Sat, 12/13/2014 - 18:06
#1
There's no pre-delete event.
There's no pre-delete event. Currently most keyboard keys (although not all and not in all cases) are handled by browsers, so to know that a widget will be deleted you would need to listen on keydown, analyse the selection and guess if now a widget will be deleted. This is pretty complicated.
Currently you could use events like widget.repository#instanceDestroyed, but you would need to check widgets more often, because by default only few actions refresh the instances kept in repository (it's more of a garbage collection, than live tracking). But of course all this you can do post-delete, just like listening to editor#change.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+