So I have this code to create an editor with a shared toolbar:
then I have this code to destroy it, from a button click:
However, once the destroy is executed, I get this error:
which may probably mean that a toolbar exists without its editor. SO I was wondering how I can destroy the shared toolbar along with the editor too?
var editor = $('#' + elementId).ckeditor({ sharedSpaces:{ top:'SharedToolbar' }, toolbar:[ ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'] ], removePlugins : 'maximize,resize,elementspath' });
then I have this code to destroy it, from a button click:
var instance = CKEDITOR.instances[elementId]; if (instance) { instance.destroy(); container.find('.control_edit').show(); if ($.isEmptyObject(CKEDITOR.instances)){ alert('Rar'); } }
However, once the destroy is executed, I get this error:
i.contentWindow is null
which may probably mean that a toolbar exists without its editor. SO I was wondering how I can destroy the shared toolbar along with the editor too?
Re: CKEditor Destroy Shared Toolbar
It works for me
I do almost the same as you - except I don't use jQuery and I have set up the sharedToolbar in the config file:
config.js:
topSpace
is the id of a DIV tag:
creating the CKEditor instance:
where toolbar is an array of toolbar items for that particular DIV (in my project the toolbar varies depending on the DIV)
destroying the CKEditor:
In my project an instance of CKEditor is created every time a user clicks on a paragraph and destroys it again after leaving the paragraph. This allows for concurrent editing in a big project - when I on the server side keep track of who has which rights (not allowing two people to edit the same paragraph)... The toolbar is always located at the top of the screen but hidden when no paragraphs are in "edit" mode