var FROALA_CMD;
(function (FROALA_CMD) {
    FROALA_CMD["FULLSCREEN_CMD"] = "fullscreen";
    FROALA_CMD["LINK_CMD"] = "insertLink";
    FROALA_CMD["SPECIAL_CMD"] = "specialCharacters";
    FROALA_CMD["HIDE_CMD"] = "hide";
    FROALA_CMD["SUBMENU_CMD"] = "-sub-menu";
    FROALA_CMD["IMAGE_CMD"] = "insertImage";
})(FROALA_CMD || (FROALA_CMD = {}));
var SubMenuPlugin = /** @class */ (function () {
    function SubMenuPlugin(editor, buttonNames) {
        var _this = this;
        this.editor = editor;
        this.isSubmenuVisible = false;
        this.HIDE_ANIMATION_DURATION = 200;
        this.SHOW_ANIMATION_DURATION = 200;
        this.subButtons = buttonNames.map(function (name) { return _this.editor.$tb.find(".fr-command[data-cmd=\"" + name + "\"]"); });
    }
    SubMenuPlugin.prototype.showSubMenu = function () {
        var _this = this;
        if (!this.isSubmenuVisible) {
            // hide buttons that are not in submenus
            this.editor.$tb.find(".fr-command[data-cmd=\"" + FROALA_CMD.FULLSCREEN_CMD + "\"]").hide(this.HIDE_ANIMATION_DURATION);
            this.editor.$tb.find(".fr-command[data-cmd=\"" + FROALA_CMD.LINK_CMD + "\"]").hide(this.HIDE_ANIMATION_DURATION);
            this.editor.$tb.find(".fr-command[data-cmd=\"" + FROALA_CMD.SPECIAL_CMD + "\"]").hide(this.HIDE_ANIMATION_DURATION);
            this.editor.$tb.find(".fr-command[data-cmd=\"" + FROALA_CMD.IMAGE_CMD + "\"]").hide(this.HIDE_ANIMATION_DURATION);
            // hide toggle buttons
            this.editor.$tb.find(".fr-command[data-cmd*=\"" + FROALA_CMD.SUBMENU_CMD + "\"]").hide(this.HIDE_ANIMATION_DURATION, function () {
                // show hide button
                _this.editor.$tb.find(".fr-command[data-cmd=\"" + FROALA_CMD.HIDE_CMD + "\"]").show(_this.SHOW_ANIMATION_DURATION);
                // show sub-menu buttons
                _this.subButtons.forEach(function (btn) { return btn.show(_this.SHOW_ANIMATION_DURATION); });
            });
            this.isSubmenuVisible = true;
        }
    };
    SubMenuPlugin.prototype.hideSubMenu = function () {
        var _this = this;
        if (this.isSubmenuVisible) {
            // show sub-menu buttons
            this.subButtons.forEach(function (btn) { return btn.hide(_this.HIDE_ANIMATION_DURATION); });
            // hide hide button
            this.editor.$tb.find(".fr-command[data-cmd=\"" + FROALA_CMD.HIDE_CMD + "\"]").hide(this.HIDE_ANIMATION_DURATION, function () {
                // show toggle buttons
                _this.editor.$tb.find(".fr-command[data-cmd*=\"" + FROALA_CMD.SUBMENU_CMD + "\"]").show(_this.SHOW_ANIMATION_DURATION);
                // show buttons that are not in submenus
                _this.editor.$tb.find(".fr-command[data-cmd=\"" + FROALA_CMD.FULLSCREEN_CMD + "\"]").show(_this.SHOW_ANIMATION_DURATION);
                _this.editor.$tb.find(".fr-command[data-cmd=\"" + FROALA_CMD.LINK_CMD + "\"]").show(_this.SHOW_ANIMATION_DURATION);
                _this.editor.$tb.find(".fr-command[data-cmd=\"" + FROALA_CMD.SPECIAL_CMD + "\"]").show(_this.SHOW_ANIMATION_DURATION);
                _this.editor.$tb.find(".fr-command[data-cmd=\"" + FROALA_CMD.IMAGE_CMD + "\"]").show(_this.SHOW_ANIMATION_DURATION);
            });
            this.isSubmenuVisible = false;
        }
    };
    return SubMenuPlugin;
}());
export default SubMenuPlugin;
//# sourceMappingURL=submenu-plugin.js.map