Code coverage report for src/js/base/module/ImagePopover.js

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

90.91% Statements 30/33
16.67% Branches 1/6
100% Functions 10/10
90.63% Lines 29/32

    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
    601×
    1×
    1×
    1×
    1×

    1×
    2×
    97×
    97×
    97×
    97×
    97×
    97×

    4×

    1×
    170×

    1×
    97×

    97×
    97×

    1×
    2×

    1×
    71×

    71×

    1×
    75×

    1×

    1×

     (function(global){global.wrappers['/Users/lqez/Dev/summernote/src/js/base/module/ImagePopover.js']=[function(require,module,exports,__dirname,__filename){ "use strict";
    exports.__esModule = true;
    var jquery_1 = require("jquery");
    var lists_1 = require("../core/lists");
    var dom_1 = require("../core/dom");
    /**
     * Image popover module
     *  mouse events that show/hide popover will be handled by Handle.js.
     *  Handle.js will receive the events and invoke 'imagePopover.update'.
     */
    var ImagePopover = /** @class */ (function () {
        function ImagePopover(context) {
            var _this = this;
            this.context = context;
            this.ui = jquery_1["default"].summernote.ui;
            this.editable = context.layoutInfo.editable[0];
            this.options = context.options;
            this.events = {
                'summernote.disable': function () {
                    _this.hide();
                }
            };
        }
        ImagePopover.prototype.shouldInitialize = function () {
            return !lists_1["default"].isEmpty(this.options.popover.image);
        };
        ImagePopover.prototype.initialize = function () {
            this.$popover = this.ui.popover({
                className: 'note-image-popover'
            }).render().appendTo(this.options.container);
            var $content = this.$popover.find('.popover-content,.note-popover-content');
            this.context.invoke('buttons.build', $content, this.options.popover.image);
        };
        ImagePopover.prototype.destroy = function () {
            this.$popover.remove();
        };
        ImagePopover.prototype.update = function (target, event) {
            Iif (dom_1["default"].isImg(target)) {
                var pos = dom_1["default"].posFromPlaceholder(target);
                var posEditor = dom_1["default"].posFromPlaceholder(this.editable);
                this.$popover.css({
                    display: 'block',
                    left: this.options.popatmouse ? event.pageX - 20 : pos.left,
                    top: this.options.popatmouse ? event.pageY : Math.min(pos.top, posEditor.top)
                });
            }
            else {
                this.hide();
            }
        };
        ImagePopover.prototype.hide = function () {
            this.$popover.hide();
        };
        return ImagePopover;
    }());
    exports["default"] = ImagePopover;

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