通过jQuery配置编辑器时配置工具栏 [英] Configure the toolbar when the editor is configured through jQuery

查看:63
本文介绍了通过jQuery配置编辑器时配置工具栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循以下示例,它的工作原理类似于魅力:

I'v followed the following example, and it works like charm:

jquery的CKeditor

CKeditor for jquery

要创建编辑器实例,而不是通常的CKEditor核心脚本, 您需要在以下页面中加载jQuery Adapter文件 顺序:

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:

此时,任何textarea,p或div元素都可以转换为 只需使用ckeditor()方法即可创建富文本编辑器:

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();

$( 'textarea.editor' ).ckeditor();

我使用Struts 2和那里的ajax验证支持(struts2-jquery插件),因此使用插件的Submit按钮.到目前为止一切都很好.但是用户仍然倾向于单击工具栏上的保存"按钮,该按钮以旧的方式提交整个表单,这破坏了我的逻辑.

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.

如何禁用工具栏中的保存"按钮?我想我真正要问的是,如何按照上面链接中的描述进行初始化时如何访问ckeditor config对象,因为我已经找到了有关将工具栏初始化为正常"非jquery的方法的文档道路. http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Toolbar

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

您可以在ckeditor根目录下的config.js文件中定义其他工具栏配置.然后,在初始化编辑器时,只需传入指向工具栏配置名称的属性即可.

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.

$('textarea.editor').ckeditor(function(){}, {toolbar: 'Basic'})

这篇关于通过jQuery配置编辑器时配置工具栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆