I wanted to open my editor maximized when clicking on a link or button, and then close it entirely with a custom "close" button (plugin). I had some trouble because when you just destroy the editor while maximized, the styles of the page you've opened the editor on get screwed up (at least for me). Also when you fire the execCommand in the exec part of addCommand, the rest of the code in that exec isn't executed anymore. (I think only one command can be executed at any time.) Anyway, I found a solution
Code for firing CKEditor
<button type="button" onclick="fireCKEditor();">Open editor</button> <script type="text/javascript"> function fireCKEditor () { var editor = CKEDITOR.replace( "myEditor", { extraPlugins: "close", toolbar: [ ["close"], <rest of your toolbar> ], <rest of your config> } ); editor.on("instanceReady", function (event) { event.editor.execCommand("maximize"); }); } </script>
Re: Open maximized, destroy on close plugin - code snippet
Re: Open maximized, destroy on close plugin - code snippet
I can't really figure out why. Anyone?..