簡體   English   中英

CKEditor-小部件-為按鈕設置工具欄

[英]CKEditor - Widget - set a toolbar for the button

在CKEditor插件中,您可以使用以下命令為按鈕指定工具欄:

    init:function(editor){
        editor.ui.addButton('myplug',{
            label:'my plug',
            command:'myplug',
            toolbar:'mytoolbar'

使用小部件,我找不到這種可能性。 有沒有一種方法可以在不移動JS中的節點的情況下做到這一點,這有點復雜?

您可以對小部件執行相同的操作。 這是窗口小部件的plugin.js文件,在init函數下具有按鈕和工具欄聲明:

CKEDITOR.plugins.add( 'mywidget', {
    requires: 'widget',
    icons: 'mywidget',
    init: function( editor ) {
        CKEDITOR.dialog.add('mywidget', this.path + 'dialogs/mywidget.js')
        editor.widgets.add( 'mywidget' , {
            //
            // Your widget logic is here ...
            //
        });

        editor.ui.addButton('mywidget', {
            label: 'My Widget'
            command: 'mywidget'
            toolbar: 'mytoolbar, 1'
        });
    }
} );

您需要在config.js文件中添加“ mytoolbar”工具欄,但是我想您已經擁有了,因為您提到了能夠為插件添加按鈕。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM