# all files / src/js/base/module/ HelpDialog.js

76.74% Statements 33/43
50% Branches 3/6
64.29% Functions 9/14
76.19% Lines 32/42

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    811×
    1×
    1×
    1×
    1×
    2×
    97×
    97×
    97×
    97×
    97×
    97×

    1×
    97×
    97×

    97×

    97×

    1×
    2×
    2×

    1×
    97×
    97×
    97×
    2619×
    2619×
    2619×

    2619×

    1×

    1×

    1×

    1×

     (function(global){global.wrappers['/Users/lqez/Dev/summernote/src/js/base/module/HelpDialog.js']=[function(require,module,exports,__dirname,__filename){ "use strict";
    exports.__esModule = true;
    var jquery_1 = require("jquery");
    var env_1 = require("../core/env");
    var HelpDialog = /** @class */ (function () {
        function HelpDialog(context) {
            this.context = context;
            this.ui = jquery_1["default"].summernote.ui;
            this.$body = jquery_1["default"](document.body);
            this.$editor = context.layoutInfo.editor;
            this.options = context.options;
            this.lang = this.options.langInfo;
        }
        HelpDialog.prototype.initialize = function () {
            var $container = this.options.dialogsInBody ? this.$body : this.$editor;
            var body = [
                '<p class="text-center">',
                '<a href="http://summernote.org/" target="_blank">Summernote @@VERSION@@</a> · ',
                '<a href="https://github.com/summernote/summernote" target="_blank">Project</a> · ',
                '<a href="https://github.com/summernote/summernote/issues" target="_blank">Issues</a>',
                '</p>',
            ].join('');
            this.$dialog = this.ui.dialog({
                title: this.lang.options.help,
                fade: this.options.dialogsFade,
                body: this.createShortcutList(),
                footer: body,
                callback: function ($node) {
                    $node.find('.modal-body,.note-modal-body').css({
                        'max-height': 300,
                        'overflow': 'scroll'
                    });
                }
            }).render().appendTo($container);
        };
        HelpDialog.prototype.destroy = function () {
            this.ui.hideDialog(this.$dialog);
            this.$dialog.remove();
        };
        HelpDialog.prototype.createShortcutList = function () {
            var _this = this;
            var keyMap = this.options.keyMap[env_1["default"].isMac ? 'mac' : 'pc'];
            return Object.keys(keyMap).map(function (key) {
                var command = keyMap[key];
                var $row = jquery_1["default"]('<div><div class="help-list-item"/></div>');
                $row.append(jquery_1["default"]('<label><kbd>' + key + '</kdb></label>').css({
                    'width': 180,
                    'margin-right': 10
                })).append(jquery_1["default"]('<span/>').html(_this.context.memo('help.' + command) || command));
                return $row.html();
            }).join('');
        };
        /**
         * show help dialog
         *
         * @return {Promise}
         */
        HelpDialog.prototype.showHelpDialog = function () {
            var _this = this;
            return jquery_1["default"].Deferred(function (deferred) {
                _this.ui.onDialogShown(_this.$dialog, function () {
                    _this.context.triggerEvent('dialog.shown');
                    deferred.resolve();
                });
                _this.ui.showDialog(_this.$dialog);
            }).promise();
        };
        HelpDialog.prototype.show = function () {
            var _this = this;
            this.context.invoke('editor.saveRange');
            this.showHelpDialog().then(function () {
                _this.context.invoke('editor.restoreRange');
            });
        };
        return HelpDialog;
    }());
    exports["default"] = HelpDialog;

    },'src/js/base/module/HelpDialog.js',{"jquery":"/Users/lqez/Dev/summernote/node_modules/jquery/dist/jquery.js","../core/env":"/Users/lqez/Dev/summernote/src/js/base/core/env.js"}];})(this);
    //# sourceMappingURL=data:application/json;charset=utf-8;base64,