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

时间:2013-11-24 04:57:50

标签: ckeditor

我已从CKEditor工具栏中删除了打印按钮...现在我希望打印按钮位于CKEditor旁边的另一个div标签中的CKEditor之外。 ..我希望打印按钮具有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'] },



];

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

1 个答案:

答案 0 :(得分:3)

您可以直接参考打印命令。尝试像这样的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>