2012-10-05 88 views
4

我正在自定義CKEditor工具欄。我想添加IFrame,如何做到這一點?如何在CKEditor中添加IFrame工具?

我的代碼,我曾嘗試:

CKEDITOR.replace('editor1',{ 
      toolbar : 
       [ 
        ['SpellChecker','Bold', 'Italic','Underline','Subscript','Superscript'], 
        ['NumberedList','BulletedList','-','Blockquote','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], 
        ['Link', 'Unlink','Anchor'] ,['Image','Flash','Table','HorizontalRule','SpecialChar','IFrame'], 
        '/', 
        ['Styles','Format','Font','FontSize' ], 
        ['TextColor','BGColor'], 
        ['Maximize'] 
       ] 
      }); 

回答

9

我使用的CKEditor在我自己的項目,我的配置文件看起來像這樣。我用小寫的'f'引用IFrame插件。

CKEDITOR.editorConfig = function (config) { 

config.toolbar = 'Full'; 
config.toolbar_Full = 
[ 
    { name: 'document', items: ['Source', '-', 'Save', 'NewPage', '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', 'Iframe'] }, 
    '/', 
    { name: 'styles', items: ['Styles', 'Format', 'Font', 'FontSize'] }, 
    { name: 'colors', items: ['TextColor', 'BGColor'] }, 
    { name: 'tools', items: ['Maximize', 'ShowBlocks', '-', 'About'] } 
]; 
};