CKEditor Custom Plugins Button

前端 未结 7 762
猫巷女王i
猫巷女王i 2020-12-22 22:41

I\'ve written a custom plugin for CKEditor--successful on all fronts, save one currently: I can\'t, for the life of me, figure out how to customize the image on the button

7条回答
  •  礼貌的吻别
    2020-12-22 23:23

    The answer is to set the icon property of the button settings like so:

            editor.ui.addButton('your-plugin', {
                label: 'Your Plugin Label',
                command: 'YourPlugin',
                icon: this.path + 'images/your-plugin.jpg'
            });
    

    Your plugin directory should have an "images" subdirectory where your button should go. In the above snippet, replace "your-plugin.jpg' with the JPG, GIF or PNG image for your button.

    This answer, of course, assumes that you know how to create a button image using some image editor like Gimp, Photoshop, etc.

提交回复
热议问题