How to add buttons on ckeditor widgets that have some functionality built in?

冷暖自知 提交于 2019-12-05 19:01:24

I did it by inserting the following code in editor.widgets.add( 'simplebox', { init property.

that = this;
buttons = this.element.getElementsByTag("button");

//getItem(2) points to the third button element which is delete
buttons.getItem(2).on("click", function() {
    //destroys the dom of the widget
    that.wrapper.remove();
    //destroys widget from memory
    CKEDITOR.instances.editor1.widgets.destroy(that, true);
});

wrapper.remove() removes dom elements of the widget and the next line destroys widget implementation.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!