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

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

64.29% Statements 18/28
0% Branches 0/2
45.45% Functions 5/11
62.96% Lines 17/27

    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
    431×
    1×
    1×
    1×
    2×
    97×
    97×
    97×
    97×
    97×

    1×
    99×

    1×

    1×

    1×

    1×

    1×

     (function(global){global.wrappers['/Users/lqez/Dev/summernote/src/js/base/module/Placeholder.js']=[function(require,module,exports,__dirname,__filename){ "use strict";
    exports.__esModule = true;
    var jquery_1 = require("jquery");
    var Placeholder = /** @class */ (function () {
        function Placeholder(context) {
            var _this = this;
            this.context = context;
            this.$editingArea = context.layoutInfo.editingArea;
            this.options = context.options;
            this.events = {
                'summernote.init summernote.change': function () {
                    _this.update();
                },
                'summernote.codeview.toggled': function () {
                    _this.update();
                }
            };
        }
        Placeholder.prototype.shouldInitialize = function () {
            return !!this.options.placeholder;
        };
        Placeholder.prototype.initialize = function () {
            var _this = this;
            this.$placeholder = jquery_1["default"]('<div class="note-placeholder">');
            this.$placeholder.on('click', function () {
                _this.context.invoke('focus');
            }).html(this.options.placeholder).prependTo(this.$editingArea);
            this.update();
        };
        Placeholder.prototype.destroy = function () {
            this.$placeholder.remove();
        };
        Placeholder.prototype.update = function () {
            var isShow = !this.context.invoke('codeview.isActivated') && this.context.invoke('editor.isEmpty');
            this.$placeholder.toggle(isShow);
        };
        return Placeholder;
    }());
    exports["default"] = Placeholder;

    },'src/js/base/module/Placeholder.js',{"jquery":"/Users/lqez/Dev/summernote/node_modules/jquery/dist/jquery.js"}];})(this);
    //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUGxhY2Vob2xkZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ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