Configure the toolbar when the editor is configured through jQuery

旧街凉风 提交于 2019-12-24 03:09:44

问题


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' ).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


回答1:


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'})


来源:https://stackoverflow.com/questions/6962488/configure-the-toolbar-when-the-editor-is-configured-through-jquery

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!