CKeditor: plugin configuration through CKeditor configuration

I am looking for any trick to configure my plugin with arguments in the CKEditor configuration. I need to pass some parameters that I can only pass when displaying my view.

I need something like this (sample with jQuery adapter):

jQuery('textarea.wysiwyg').ckeditor(function(){},{
        'width'             : '640px',
        'resize_maxWidth'   : '640px', 
        'extraPlugins'      : 'my_plugin',
        'toolbar'           : [['Bold', 'Italic', '-', 'NumberedList', 'BulletedList'],['Link', 'Unlink','-','MyPlugin'],['Paste','PasteFromWord'],['Source']]
        'my_plugin'         : {
              'param1'      : 'value1',
              'param2'      : 'value2',
        }

});

But I have not yet found any plugin configuration information with CKEditor.

+3
source share
2 answers

I answer my question: In the plugin module, the init method accepts the editor as an argument, the editor contains config (which can be called editor.config), so you can access the entire configuration defined when creating the ckeditor instance.

:

CKEDITOR.plugins.add( 'my_plugin',
{
    init: function( editor )
    {
        var param1 = editor.config.value1;
    }
}

, , CKEDITOR.config. , CKEDITOR.config.extraConfig, .

+4

jQuery('textarea.wysiwyg').ckeditor(function(){}, 
{
        config.extraConfig : { 'param1' : 'value1', 'param2' : 'value2' }
});

CKEDITOR.plugins.add( 'my_plugin',
{
    init: function( editor )
    {
        var param1 = editor.extraConfig.param1;
        var param2 = editor.extraConfig.param2;
    }
}
+1

All Articles