Javascript在加载时删除ckeditor插件

Javascript在加载时删除ckeditor插件,javascript,ckeditor,Javascript,Ckeditor,Html: <textarea name="Editor" class="ckeditor" id="aboutme">@Model.Content</textarea> @Model.Content Javascript: <script> config.removePlugins = 'elementspath,save,font'; </script> config.removePlugins='elementspath,sa

Html:

<textarea name="Editor" class="ckeditor" id="aboutme">@Model.Content</textarea>
@Model.Content
Javascript:

<script>
    config.removePlugins = 'elementspath,save,font';
</script>

config.removePlugins='elementspath,save,font';
当页面加载时,我想禁用所有的ckeditor插件。我尝试了上面的代码,但它不适合我

如何在加载页面时通过javascript删除插件

任何帮助都是感激的。
谢谢。

您可以定义要加载的插件列表():

但您也可以限制现有(默认)插件列表():

这两个选项都可以全局定义(
config.js
)或为特定的编辑器实例定义,如

CKEDITOR.replace( 'editor1', {
    removePlugins: 'link'
} );
请参考官方指南了解更多信息


注意:自CKEditor 4.1以来,插件的存在决定了与该插件关联的特定类型内容是允许的还是不允许的。阅读更多信息。

在对oleq答案的评论中回答我自己的问题:

我使用了一个CKEditor实例(与jQuery一起使用),如下所示:

我能够通过这种方式成功地删除“链接”插件。我将使用公共属性“extraPlugins”和“removePlugins”设置ASP.net用户控件,并使用客户端黄色标记(“代码块”)插入值,以便能够在启用/禁用不同插件的多个页面上使用此控件


我希望这能帮助别人

您还可以编辑config.js。此js从ckeditor.js加载/包含。config.js是默认的自定义编辑器js文件。通过包含要删除的元素的名称列表,可以从编辑器中删除按钮或插件。有关要从编辑器中删除的名称列表,请参阅以下链接:

通过将按钮或插件添加到config.removebuttons,包括要从编辑器中删除的按钮或插件列表,并在config.js中包含这行代码

// Remove some buttons provided by the standard plugins, which are
// not needed in the Standard(s) toolbar.
config.removeButtons = 'Underline,Subscript,Superscript,Image,Flash,Table,HorizontalRule,Smiley...';

'editor1'
名称来自哪里?您何时运行该代码,是否只有在首次初始化编辑器时才运行?一旦编辑器已经加载,如何添加/删除插件?这是如何与
ckeditor()
函数本身交互的?文档没有很好地解释问题…“editor1”是要用ckeditor替换的textarea的默认id。您可以将其更改为您自己的任何idhtml@Acyra我想为将要创建的所有ckeditor实例删除它(例如,contenteditable=“true”的DIVs,将来单击它们时将成为ckeditor)。我该怎么做?没有名为“config”的全局变量来设置“removePlugs”。当CKEDITOR被定义时,似乎已经太晚了,插件已经加载了!
CKEDITOR.replace( 'editor1', {
    removePlugins: 'link'
} );
window.onload = function () {
        $ckTarget = $(".pageContentTextBox");
        if ($(".pageContentTextBox").length > 0) {
            $ckEditor = $ckTarget.ckeditor({
                htmlEncodeOutput: true,
                removePlugins: "link"
            });
        }
};
// Remove some buttons provided by the standard plugins, which are
// not needed in the Standard(s) toolbar.
config.removeButtons = 'Underline,Subscript,Superscript,Image,Flash,Table,HorizontalRule,Smiley...';