使用类名替换方法时改变CKeditor的宽度

时间:2014-03-17 15:57:02

标签: javascript ckeditor

我正在使用CKeditor并且我使用this方法来使用它,所以我没有直接绑定它,因此不知道如何通过配置文件本身更改配置选项;我整个网站都有几个CKeditor实例,所以我不能这样做。

如何使用我的方法动态更改它的宽度?

1 个答案:

答案 0 :(得分:0)

首先 - Setting CKEditor configuration的文档非常有用。它描述了所有这些标准方法。

因此,您可以在调用CKEDITOR.replace(或其他创建者,如inlineappendTo)或配置文件时指定配置。这些是标准方式。

由于CKEditor基于事件的架构,存在更多方法。其中一个用于Massive inline editing样本。

// The "instanceCreated" event is fired for every editor instance created.
CKEDITOR.on( 'instanceCreated', function( evt ) {
    var editor = event.editor;

    // You can choose how each editor should be configured based on
    // any criterias you want, like e.g. its name.
    if ( editor.name == 'foo' ) {
        // Customize the editor configurations on "configLoaded" event,
        // which is fired after the configuration file loading and
        // execution. This makes it possible to change the
        // configurations before the editor initialization takes place.
        editor.on( 'configLoaded', function() {
            editor.config.height = 500;
        } );
    }
} );