desperate man
desperate man

Reputation: 904

How to trigger an event when plugin is closed/destroyed?

I have a CKEditor instance with custom plugins. I thought that when CKEDITOR.instances[element.name].destroy(true) is called it will call some kind of "destroy" events of all the plugins, but I couldn't find any API reference about such en event available for plugins.

How can I execute an event or function inside plugin that will contain special logic of cleaning things related to that plugin?

Upvotes: 0

Views: 384

Answers (1)

oleq
oleq

Reputation: 15895

CKEditor fires editor#destroy event by default. Just put your cleanup logic into the callback:

editor.on( 'destroy', function() {
    // cleanup goes here
} );

There is no corresponding event for the plugins because there's no such need: all the plugins die along with the editor (editor.destroy()). Always.

Upvotes: 2

Related Questions