I have done numerous searches on the forum and have not been able to learn how I can "hijack" the Save button. Basically, I would like to apply my own custom function to the save button.
I even tried adding an onsubmit method to my form element but it does not seem to do the trick.
Any help would be appreciated.
I even tried adding an onsubmit method to my form element but it does not seem to do the trick.
Any help would be appreciated.
Re: How to HiJack Save Button
That way I could still upgrade CKEditor without worries.
Re: How to HiJack Save Button
From my understanding, creating a custom plugin is a 3 step process, correct?
If I create a 'mysave' plugin with a button named 'My Save', I would have to do the following:
1. Create plugin.js in CKEditorDirectory/plugins/mysave with my custom code
2. Modify my CKEDITOR.replace to include extraPlugins:'mysave' AND ensure that 'My Save' is listed in the toolbar: property
3. If I am using the kama skin, for example, modify CKEditorDirectory/skins/kama/editor.css by adding the following:
Since I will be ommitting 'Save' from my toolbar: property should i also use removePlugins:'save'? If so, what is the benefit?
Lastly, will the custom plugin 'mysave' reload with every CKEDITOR.replace or will it just load it once and keep in memory just in case other editor instances require that plugin?
Thanks!
Re: How to HiJack Save Button
/_samples/api_dialog.html
shows you how to assign a button without hacking into the skins.
I also as a little bit of simplicity gave my command the name of 'save' even tho my plugin was called 'MySave' which I believe is why it quite happily used the existing save graphic.
If you don't want the original save button in your toolbar then you might as well remove the plugin as then you are not loading up irrelevant code. And less code should equal a faster site
if you altered the config.js file to add/remove the plugins then it should be available in each instance of replace.
If you stated in the replace call then you need to do it in each replace call as you can specify different toolbars for different instances of the editor etc etc. (I believe - but the only way to find out is give it a try...)