System.register(["./inputButton", "froala-editor"], function (exports_1, context_1) {
    "use strict";
    var inputButton_1, froala_editor_1;
    var __moduleName = context_1 && context_1.id;
    return {
        setters: [
            function (inputButton_1_1) {
                inputButton_1 = inputButton_1_1;
            },
            function (froala_editor_1_1) {
                froala_editor_1 = froala_editor_1_1;
            }
        ],
        execute: function () {
            froala_editor_1.default.DEFAULTS = Object.assign(froala_editor_1.default.DEFAULTS, {});
            froala_editor_1.default.PLUGINS.menuButton = function menuButton(editor) {
                let inputButton;
                const debug = false;
                function _init() {
                    inputButton = new inputButton_1.InputButtonPlugin({
                        name: 'Menu Button',
                        eventName: 'menu-button',
                        editor,
                        debug
                    });
                    if (debug) {
                        console.log('initialized:', {
                            options: editor.opts.endpoint,
                            instance: this
                        });
                    }
                }
                function onClick() {
                    if (!editor.el) {
                        console.warn('menuButton.onClick(): unable to find element');
                        return;
                    }
                    inputButton.onClick(editor.el);
                }
                return {
                    _init,
                    onClick
                };
            };
            if (froala_editor_1.default.DEFAULTS) {
                if (typeof froala_editor_1.default.DEFAULTS.menuButtons === 'undefined') {
                    froala_editor_1.default.DEFAULTS.menuButtons = [];
                }
                froala_editor_1.default.DEFAULTS.menuButtons.push('menuButton');
            }
            froala_editor_1.default.RegisterCommand('menuButton', {
                title: 'Insert from Menu Button',
                undo: false,
                focus: false,
                modal: false,
                refreshAfterCallback: true,
                callback() {
                    const debug = false;
                    if (debug) {
                        console.log('clicked:', this.menuButton);
                    }
                    this.menuButton.onClick();
                },
                plugin: 'menuButton',
            });
            froala_editor_1.default.DefineIcon('menuButton', { NAME: 'folder', SVG_KEY: 'imageManager' });
            froala_editor_1.default.DefineIcon('menuButtonInsert', { NAME: 'plus', SVG_KEY: 'add' });
            froala_editor_1.default.DefineIcon('menuButtonDelete', { NAME: 'trash', SVG_KEY: 'remove' });
            froala_editor_1.default.RegisterQuickInsertButton('menu', {
                icon: 'menuButton',
                title: 'Insert from Menu Button',
                callback: function menuButtonCallback() {
                    const debug = false;
                    const inputButton = new inputButton_1.InputButtonPlugin({
                        name: 'Menu Button',
                        eventName: 'menu-button',
                        editor: this,
                        debug
                    });
                    if (!this.el) {
                        console.warn('menuButton.onClick(): unable to find element');
                        return;
                    }
                    inputButton.onClick(this.el);
                },
                undo: true
            });
        }
    };
});

//# sourceMappingURL=menuButton.js.map
