gpt4 book ai didi

configuration - 如何自定义 CK-Editor 的工具菜单?

转载 作者:行者123 更新时间:2023-12-04 06:27:41 24 4
gpt4 key购买 nike

我想更改 ckeditor 上的工具菜单选项。
例如我删除了一些我不需要使用的。
我怎样才能做到这一点 ?

最佳答案

有一个配置设置,可让您设置将显示哪些按钮。

您只需创建自己的工具栏布局。我已经包含了默认的完整工具栏代码,您可以删除不想出现的按钮。

最好复制默认的 config.js 文件并重命名,然后在加载编辑器时调用自定义配置文件和自定义工具栏:

CKEDITOR.replace( 'xxx_textarea_id_xxx',
{
customConfig : 'xxx_name_of_custom_config_file_xxx.js',
toolbar : 'XXX_custom_name_XXX'
});

这是默认完整工具栏布局的配置设置。
'/'在工具栏布局内意味着换行。 name: 'document', items :每个条目都显示为一个组,条目之间有空格。 '-'在组内创建一个垂直间隔。

演示页面显示了此默认工具栏布局的示例:
CKEditor Demo
config.toolbar_Full =
[
{ name: 'document', items : [ 'Source','-','Save','NewPage','DocProps','Preview','Print','-','Templates' ] },
{ name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
{ name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','SpellChecker', 'Scayt' ] },
{ name: 'forms', items : [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] },
'/',
{ name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] },
{ name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl' ] },
{ name: 'links', items : [ 'Link','Unlink','Anchor' ] },
{ name: 'insert', items : [ 'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak' ] },
'/',
{ name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] },
{ name: 'colors', items : [ 'TextColor','BGColor' ] },
{ name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About' ] }
];

这是自定义工具栏配置设置。
当您设置工具栏配置设置时,您只使用“toolbar_”之后的名称部分。 toolbar : 'XXX_custom_name_XXX'
config.toolbar_XXX_custom_name_XXX =
[
{ name: 'xxx_custom_group_namexxx', items : ['Save','NewPage','DocProps','Preview','Print','-','Templates' ] },
{ name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
{ name: 'editing', items : [ 'Find','Replace','-','SelectAll' ] },
'/',
{ name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] },
{ name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl' ] },
{ name: 'links', items : [ 'Link','Unlink','Anchor' ] },
{ name: 'insert', items : [ 'Image','Table','HorizontalRule','Smiley','SpecialChar','PageBreak' ] },
'/',
{ name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] },
{ name: 'colors', items : [ 'TextColor','BGColor' ] },
{ name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About' ] }
];

这是开发人员指南中工具栏页面的链接:
CKEditor 3.x | Developers Guide - CKEditor Toolbar

您可能想要关闭任何不用于 removePlugins 的功能。配置设置:
config.removePlugins = 'flash,iframe';

这是 CKEditor 3 JavaScript API 文档中列出所有配置设置的页面:
Namespace CKEDITOR.config

关于configuration - 如何自定义 CK-Editor 的工具菜单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12813359/

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