all files / rich-text-editor/actions/ execute-command-callback.js

100% Statements 20/20
100% Branches 10/10
100% Functions 6/6
100% Lines 20/20
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   1818× 1818×   1818× 1818×   1242× 1242× 1112×   1242× 1242×   1817× 1817×        
define(["require", "exports", "../base/constant", "@syncfusion/ej2-base"], function (require, exports, events, ej2_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var ExecCommandCallBack = (function () {
        function ExecCommandCallBack(parent) {
            this.parent = parent;
            this.addEventListener();
        }
        ExecCommandCallBack.prototype.addEventListener = function () {
            this.parent.on(events.execCommandCallBack, this.commandCallBack, this);
            this.parent.on(events.destroy, this.removeEventListener, this);
        };
        ExecCommandCallBack.prototype.commandCallBack = function (args) {
            var formatPainterCopy = !ej2_base_1.isNullOrUndefined(args.requestType) && args.requestType === 'FormatPainter' && args.action === 'format-copy';
            if (!ej2_base_1.isNullOrUndefined(args) && !ej2_base_1.isNullOrUndefined(args.requestType) && args.requestType !== 'Undo' && args.requestType !== 'Redo' && !formatPainterCopy) {
                this.parent.formatter.saveData();
            }
            this.parent.notify(events.toolbarRefresh, { args: args });
            this.parent.notify(events.count, {});
        };
        ExecCommandCallBack.prototype.removeEventListener = function () {
            this.parent.off(events.execCommandCallBack, this.commandCallBack);
            this.parent.off(events.destroy, this.removeEventListener);
        };
        return ExecCommandCallBack;
    }());
    exports.ExecCommandCallBack = ExecCommandCallBack;
});