2013-05-14 91 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. 添加到工具欄

對不起,我不能格式化我的代碼