Froala custom close button

2019-09-17 06:15发布

问题:

I'm trying to create a custom close button for the Froala editor. I've managed to create a custom button and have it display in the froala toolbar, however I can't seem to get a close button working correctly. Can anyone give me some guidance?

My code for the custom button so far is:

JSON close button

    close: {
        title: "Close",
        icon: "fa fa-times",
        refresh: a.Editable.prototype.refreshDefault,
        undo: !0,
        callbackWithoutSelection: function(a) {
            this.close_box()
        }
    },

Close function

a.Editable.prototype.close_box = function() {
      alert();
}

回答1:

You have to use callback instead of callbackWithoutSelection. That is explained in the documentation http://editor.froala.com/examples/custom-buttons