Tho*_*ony 44
基于reinmar答案并在此测试是更好的答案.在你的ckeditor config.js中添加:
config.removeButtons = 'Underline,JustifyCenter';
Run Code Online (Sandbox Code Playgroud)
作为参考,您可以在那里找到CKeditor 4按钮的完整列表:http://ckeditor.com/comment/123266#comment-123266
Tho*_*ony 38
我最终找到了,但我不喜欢这种方式,而不是删除你不想要的东西,你定义了你想要的按钮(并且根本不放你不想要的东西).当您调用CKeditor.replace时,您可以像这样定义工具栏:
CKEDITOR.replace( 'YOURE_TEXT_AREA_ID', {
toolbar: [
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ], items: [ 'Source', '-', 'Save', 'NewPage', 'Preview', 'Print', '-', 'Templates' ] },
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ], items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] },
{ name: 'forms', items: [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] },
'/',
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language' ] },
{ name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] },
{ name: 'insert', items: [ 'Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe' ] },
'/',
{ name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
{ name: 'tools', items: [ 'Maximize', 'ShowBlocks' ] },
{ name: 'others', items: [ '-' ] },
{ name: 'about', items: [ 'About' ] }
]
});
Run Code Online (Sandbox Code Playgroud)
(作为参考,这是标准的完整工具栏)项目代表按钮,所以只需删除您不想要的项目.而已.
有没有更好的答案?
小智 13
要删除按钮,请尝试:
$(document).ready(function() {
CKEDITOR.config.removePlugins = 'Save,Print,Preview,Find,About,Maximize,ShowBlocks';
});
Run Code Online (Sandbox Code Playgroud)
逗号分隔列表必须包含要删除的每个按钮的名称.以下链接是包含工具栏ckeditor的按钮的完整列表:
在项目的scripts/ckeditor /中的config.js文件中,只需按以下方式操作即可
config.removePlugins = 'elementspath,save,image,flash,iframe,link,smiley,tabletools,find,pagebreak,templates,about,maximize,showblocks,newpage,language';
config.removeButtons = 'Copy,Cut,Paste,Undo,Redo,Print,Form,TextField,Textarea,Button,SelectAll,NumberedList,BulletedList,CreateDiv,Table,PasteText,PasteFromWord,Select,HiddenField';
Run Code Online (Sandbox Code Playgroud)
通过编辑config.js文件手动删除按钮并设置工具栏样式后,我找到了ToolBar配置器.
有了它,您可以轻松启用或禁用按钮.更改按钮组顺序并添加分隔符.
它位于/samples/toolbarconfigurator中的ckeditor文件夹中.刚推出index.html.工具栏配置器包含在下载页面上的所有不同下载包中
完成工具栏的创建后,只需单击Get toolbar config该样式并将其复制到config.js主ckeditor文件夹中的文件即可.
小智 7
打开您的 config.js 文件并粘贴此代码
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here. For example:
// config.language = 'fr';
// config.uiColor = '#AADC6E';
config.removePlugins = 'blockquote,save,flash,iframe,tabletools,pagebreak,templates,about,showblocks,newpage,language,print,div';
config.removeButtons = 'Print,Form,TextField,Textarea,Button,CreateDiv,PasteText,PasteFromWord,Select,HiddenField,Radio,Checkbox,ImageButton,Anchor,BidiLtr,BidiRtl,Font,Format,Styles,Preview,Indent,Outdent';
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
58502 次 |
| 最近记录: |