2013-05-14 155 views
0

我想将自定义按钮添加到工具栏。CKeditor工具栏:AddButton(3.6)

基于位置的信息:http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Toolbar我有这个config.js:

config.toolbar = 'MyToolbar'; 

config.toolbar_MyToolbar = 
[ 
    { 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: ['customImage', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe'] }, 
    '/', 
    { name: 'styles', items: ['Styles', 'Format', 'Font', 'FontSize'] }, 
    { name: 'colors', items: ['TextColor', 'BGColor'] }, 
    { name: 'tools', items: ['Maximize', 'ShowBlocks', '-', 'About'] } 
]; 


config.extraPlugins = 'customImage'; 

但工具栏不被改变。它保持默认状态。

回答

0

,如果你想添加一些按钮CKEDITOR,你必须做3个步骤:

  1. 写你自己的插件按钮一些像这样的事情:

    (函数(){ //当点击按钮 VAR一个=函数{ EXEC:功能(编辑){ 动作时点击按钮 } }, b = '视频管理'; CKEDITOR.plug ins.add(b,{init}:function(editor){{{0}} {0}}} editor.addCommand(b,a); editor.ui.addButton('videomanager',{ label:'Video Manager', icon:this.path +'videomanager.png', command:b }); } }); })();

  2. 注册您的插件在ckeditor配置。

  3. 添加到工具栏

对不起,我不能格式化我的代码