CKEditor-工具栏外部的打印按钮



我已经从CKEditor工具栏中删除了打印按钮。。。现在我希望print按钮位于CKEditor之外,位于CKEditor旁边的另一个div标记中。。。。并且我希望打印按钮具有CKEditor打印按钮中使用的按钮图像。。。按钮的config.js代码:

config.toolbar = [
    { name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'PasteText', 'Undo', 'Redo' ] },
    { name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ], items: [ 'Find', 'Scayt' ] },
    { name: 'colors', items: [ 'TextColor', 'BGColor' ] },
        { name: 'styles', items: [ 'Font' ] },
        { name: 'styles', items: [ 'FontSize' ] },
        { name: 'links', items: [  ] },
    { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript' ] },
    { name: 'document', groups: [ 'mode', 'document', 'doctools' ], items: [  ] }, //Print , Templates
    { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'NumberedList', 'BulletedList', 'Outdent', 'Indent', 'Blockquote', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock',  'BidiLtr', 'BidiRtl', 'language' ] },
    { name: 'insert', items: [ 'Image', 'Table', 'PageBreak' ] },
    { name: 'styles', items: [ 'Styles'] },
    { name: 'styles', items: [ 'Format'] },

];

我该怎么做我上面说的。。。??任何帮助都将不胜感激。。。提前感谢..:)

您可以直接引用print命令。试试像这样的HTML和Javascript

<div onclick="ckePrint()">Click to print</div>
<script type="text/javascript">
    function ckePrint() {
        // Replace "editor1" with your editor name
        var i = CKEDITOR.instances.editor1;
         // Edited as per the comment by Reinmar
        i.editor.execCommand( 'print' );
    }
</script>

最新更新