On destroy function, set items of editor.config.elementsPath_filters to null, but not reset length=0.
So reopening a editor with CKEDITOR.replace, fire the event of "selectionChange" on elementspath/plugin.js, throw a exception.
5345.patch​ (6.6 KB) - added by Alfonso Martínez de Lizarrondo 9 years ago.
5345_2.patch​ (2.6 KB) - added by Garry Yao 9 years ago.
5345_3.patch​ (4.1 KB) - added by Alfonso Martínez de Lizarrondo 9 years ago.
Can you provide a test page to reproduce the problem?
Any property of an editor object shouldn't matter after it has been destroyed.
run on _sample/divreplace.html (replace '../ckeditor.js' with '../ckeditor_source.js').
you may find: click part 1 and display ckeditor, select text in the editor, fire the debugger event. but click part 2 and display ckeditor, select text in the editor again, cann't fire the debugger event.
if ( filters[ i ]( element ) === false ) here, throw a exception.
Ok, the problem here is that the editor.config is created with tools.prototypedCopy from CKEDITOR.config, and when a filter is added to an instance, it ends up also in the global object, and the next time that an editor is created that array isn't empty any longer, it includes the previous data (that in editor.destroy() has been set to null).
So this is an interesting problem that deserves a real fix: if the skins.html sample is loaded, the editor.config.elementsPath_filters contains 3 instances of the same function, one added for each editor.
The patch moves the filters to editor._.elementsPath.filters to avoid having them shared among instances. After that there's no need to clean up anything on editor.destroy().
I've included also a fix for the SCAYT plugin because it fails when an editor is destroyed.
And all of them could be customized by either assignment or modification.
The patch is based on the code by Garry, but I've removed the code that allowed to set a single function in config.elementsPath_filters and I've included part of the previous cleanup to avoid the use of variables defined as a closure.
It's wrong to change prototypedCopy to clone for the configurations. prototypedCopy makes it possible to extend the configurations of all editors, at any moment in the loading process. By changing it to clone we loose functionality with no added benefit.
Having elementsPath_filters in the CKEDITOR.config was a bad decision. It would be enough to have an API function for that. Now we have complications.
This is not a kind of configuration thing which users will be using the config file. It's much more a plugin thing, which can be easily handled in the API.
We still have time to revert  and all changes related to elementsPath_filters (like things wrongly included in editor.js), introducing a new "global" function CKEDITOR.plugins.elementspath.addFilter. It doesn't need to be editor specific; it's ok to have it global.
I'm ok for attachment:5345.patch​. We can develop it later to make it a public API function, instead of using the editor._ object directly.