gpt4 book ai didi

plugins - C编辑器: Configure plugin through CKeditor's configuration

转载 作者:行者123 更新时间:2023-12-01 11:52:26 29 4
gpt4 key购买 nike

我正在寻找任何技巧来使用 CKEditor 配置中的参数配置我的插件。我必须传递一些只能在显示 View 时传递的参数。

我想要这样的东西(带有 jQ​​uery 适配器的示例):

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

});

但我还没有找到任何有关使用 CKEditor 配置插件的信息。

最佳答案

我回答我自己的问题:插件方法 init 接收编辑器作为参数,编辑器包含配置(可以称为 editor.config),因此您可以访问创建 ckeditor 实例时定义的所有配置。

使用我第一篇文章中的示例,您可以像这样访问插件中的配置:

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

我认为这不是最好的方法,因为它向 CKEDITOR.config 原型(prototype)添加了一些额外的属性。拥有属性 CKEDITOR.config.extraConfig 可能会更好,它是插件的属性映射。

关于plugins - C编辑器: Configure plugin through CKeditor's configuration,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10176913/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com