Hey,
So I'm using the demo code to replace div elements with the editor and using the code I got from a previous question I capture the save action. Once caught I perform an ajax call to save the data to my DB and then I would like the editor to disappear so I call the destroy function on the current editor. For some reason, once destroyed I can't seem to replace any other div without getting a "l.element is undefined" error.
Thing is, I thought this would work since whenever a div is clicked the previous editor is destroyed before replacing the new div with an editor, I'm not sure what the difference between both destroys are.
if(editor) { //this one doesn't seem to cause any problems editor.destroy(); } editor = CKEDITOR.replace(this, { uicolor : "#007dc3" }); function handleAfterCommandExec(event) { //grab the button that was pressed var commandName = event.data.name; // check to see if it was the save if (commandName == 'save') { //add ajax call here. // this one however breaks it editor.destroy(); } }
Any insight on what I'm doing wrong? I read the documentation on the destroy method and I would understand why it wouldn't work if the first destroy broke stuff but it doesn't Thanks for any help!
Re: Can't recreate editor after calling destroy
Re: Can't recreate editor after calling destroy
I really thought I had tried that already as a similar problem (in another thread) set the editor to null after destroying it. It works now! Thanks a lot