all files / document-editor-container/ribbon/home-tab/ line-spacing-group.js

100% Statements 25/25
100% Branches 0/0
100% Functions 9/9
100% Lines 25/25
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   14× 14× 14× 14×     120×         14× 14× 14×                                 118×          
define(["require", "exports", "../ribbon-base/ribbon-constants", "@syncfusion/ej2-ribbon", "../../helper/line-spacing-helper"], function (require, exports, ribbon_constants_1, ej2_ribbon_1, line_spacing_helper_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.LINE_SPACING_ID = '_line_spacing';
    var LineSpacingGroup = (function () {
        function LineSpacingGroup(container) {
            this.appliedLineSpacing = '1';
            this.container = container;
            this.ribbonId = this.container.element.id + ribbon_constants_1.RIBBON_ID;
            this.localObj = this.container.localObj;
        }
        Object.defineProperty(LineSpacingGroup.prototype, "documentEditor", {
            get: function () {
                return this.container.documentEditor;
            },
            enumerable: true,
            configurable: true
        });
        LineSpacingGroup.prototype.getLineSpacingItem = function () {
            var _this = this;
            var id = this.ribbonId;
            return {
                type: 'DropDown',
                keyTip: 'K',
                allowedSizes: ej2_ribbon_1.RibbonItemSize.Small,
                dropDownSettings: {
                    iconCss: 'e-de-ctnr-linespacing e-icons',
                    content: this.localObj.getConstant('Line spacing'),
                    items: line_spacing_helper_1.LineSpacingHelper.getLineSpacingItems(this.localObj),
                    select: function (args) {
                        _this.lineSpacingAction(args);
                    },
                    beforeItemRender: function (args) {
                        line_spacing_helper_1.LineSpacingHelper.customizeLineSpacingItem(args, _this.appliedLineSpacing);
                    }
                },
                id: id + exports.LINE_SPACING_ID,
                ribbonTooltipSettings: { content: this.localObj.getConstant('Line spacing') }
            };
        };
        LineSpacingGroup.prototype.setLineSpacing = function () {
            this.appliedLineSpacing = line_spacing_helper_1.LineSpacingHelper.getCurrentLineSpacing(this.documentEditor, this.localObj);
        };
        LineSpacingGroup.prototype.lineSpacingAction = function (args) {
            var appliedSpacing = { value: this.appliedLineSpacing };
            line_spacing_helper_1.LineSpacingHelper.applyLineSpacing(this.documentEditor, args.item.text, appliedSpacing, this.localObj);
            this.appliedLineSpacing = appliedSpacing.value;
        };
        return LineSpacingGroup;
    }());
    exports.LineSpacingGroup = LineSpacingGroup;
});