有没有办法为每个编辑器实例覆盖CKEditor的配置文件? [英] Is there a way to override CKEditor's config file for each instance of the editor?

查看:89
本文介绍了有没有办法为每个编辑器实例覆盖CKEditor的配置文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有全局尺寸和高度设置

I have a global size and height set

CKEDITOR.editorConfig = function( config )
{
  config.height = '400px';
  config.width = '600px';
  ...

我想仅为一个实例更改此高度和宽度在一个单独的页面上的编辑器。有没有其他人完成这个?

And I would like to change this height and width for only one instance of the editor on a seperate page. Has anyone else accomplished this?

推荐答案

是的。当您在页面上创建编辑器时,您可以覆盖

Yes. When you create the editor on the page, you can override

CKEDITOR.replace(editorName, {
            height: 448,
            width: 448,
            customConfig: '/path/to/yourconfig.js'
});

事实上,作为性能建议您可以在此处放置所有配置选项并单独保存配置文件的加载。您可以在自己的共享JavaScript文件中执行此操作,参数化以覆盖页面的特定值。

In fact as a performance recommendation you can put all the configuration options here and save the loading of the config file separately. You might do this in a shared JavaScript file of your own, parametrized to override specific values for a page.

更新以回应评论

可以使用单独的配置文件任何其他设置(使用customConfig查看上面。如果您不想要任何自定义配置加载使用

A separate config file can be used like any other setting (look above with customConfig. If you don't want any custom configs loaded use

customConfig: ''

这篇关于有没有办法为每个编辑器实例覆盖CKEditor的配置文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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