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

97.83% Statements 45/46
87.5% Branches 21/24
100% Functions 14/14
97.67% Lines 42/43
11 statements, 6 functions, 9 branches Ignored     
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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111          14×   14× 14× 14×                                                                                                             118× 118×     118× 118× 118× 82× 82×     36× 36×          
/* istanbul ignore next */ 
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
define(["require", "exports", "../ribbon-interfaces"], function (require, exports, ribbon_interfaces_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.CLIPBOARD_GROUP_ID = '_clipboard_group';
    exports.CUT_ID = '_cut';
    exports.COPY_ID = '_copy';
    exports.PASTE_ID = '_paste';
    exports.LOCAL_CLIPBOARD_ID = '_local_clipboard';
    var ClipboardGroup = (function (_super) {
        __extends(ClipboardGroup, _super);
        function ClipboardGroup() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        ClipboardGroup.prototype.getGroupModel = function () {
            var _this = this;
            var id = this.ribbonId;
            return {
                id: id + exports.CLIPBOARD_GROUP_ID,
                cssClass: 'e-clipboard-group',
                header: this.localObj.getConstant('Clipboard'),
                enableGroupOverflow: true,
                overflowHeader: this.localObj.getConstant('Clipboard'),
                groupIconCss: 'e-icons e-de-ctnr-paste',
                collections: [
                    {
                        items: [
                            {
                                type: 'Button',
                                keyTip: 'X',
                                buttonSettings: {
                                    content: this.localObj.getConstant('Cut'),
                                    iconCss: 'e-icons e-de-ctnr-cut',
                                    isToggle: false,
                                    clicked: function () {
                                        Eif (!_this.documentEditor.isReadOnly && _this.documentEditor.editor) {
                                            _this.documentEditor.editor.cut();
                                        }
                                    }
                                },
                                id: id + exports.CUT_ID,
                                ribbonTooltipSettings: { content: this.localObj.getConstant('Cut Tooltip') }
                            }, {
                                type: 'Button',
                                keyTip: 'C',
                                buttonSettings: {
                                    content: this.localObj.getConstant('Copy'),
                                    iconCss: 'e-icons e-de-ctnr-copy',
                                    isToggle: false,
                                    clicked: function () {
                                        Eif (_this.documentEditor.selection) {
                                            _this.documentEditor.selection.copy();
                                        }
                                    }
                                },
                                id: id + exports.COPY_ID,
                                ribbonTooltipSettings: { content: this.localObj.getConstant('Copy Tooltip') }
                            },
                            {
                                type: 'Button',
                                keyTip: 'V',
                                buttonSettings: {
                                    content: this.localObj.getConstant('Local Clipboard'),
                                    iconCss: 'e-icons e-de-ctnr-paste',
                                    isToggle: true,
                                    clicked: function () {
                                        _this.container.enableLocalPaste = !_this.container.enableLocalPaste;
                                    }
                                },
                                id: id + exports.LOCAL_CLIPBOARD_ID,
                                ribbonTooltipSettings: { content: this.localObj.getConstant('Toggle between the internal clipboard and system clipboard') }
                            }
                        ]
                    }
                ]
            };
        };
        ClipboardGroup.prototype.updateSelection = function () {
            var ribbon = this.container.ribbonModule.ribbon;
            Iif (!ribbon) {
                return;
            }
            var id = this.ribbonId;
            var isSelectionEmpty = this.container.documentEditor.selection.isEmpty;
            if (isSelectionEmpty) {
                ribbon.disableItem(id + exports.CUT_ID);
                ribbon.disableItem(id + exports.COPY_ID);
            }
            else {
                ribbon.enableItem(id + exports.CUT_ID);
                ribbon.enableItem(id + exports.COPY_ID);
            }
        };
        return ClipboardGroup;
    }(ribbon_interfaces_1.RibbonGroupBase));
    exports.ClipboardGroup = ClipboardGroup;
});