Configure the toolbar when the editor is configured through jQuery
I'v followed the following example, and it works like charm:
CKeditor for jquery
To create editor instances, other than the usual CKEditor core script, you need to load the jQuery Adapter file in the page, in the following order:
At this point, any textarea, p or div element can be transformed into a rich text editor by simply using the ckeditor() method:
$( 'textarea.editor' )开发者_如何学C.ckeditor();
I use Struts 2 and the ajax validation support there (the struts2-jquery plugin), so uses the plugin's submit button. So far all good. But users tend to still click the "Save" button on the toolbar which submits the whole form the old fashion way, and that destroys my logic.
How can I disable the "Save" button from the tool bar? I think what I really ask is how I get access to the ckeditor config object when initialising it the way describe in the link above since I'v already found documentation on how to configure the toolbar if you initalise it the "normal" non-jquery way. http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Toolbar
You can modify the toolbar the same way as you do it using the conventional way.
$('textarea.editor').ckeditor(<init function>, <options>)
You can define a different toolbar configuration in your config.js file in the root ckeditor directory. Then, when initializing the editor, simply pass in the property that points to the name of your toolbar configuration.
i.e.
$('textarea.editor').ckeditor(function(){}, {toolbar: 'Basic'})
精彩评论