all files / rich-text-editor/renderer/ quick-popup-renderer.js

100% Statements 30/30
100% Branches 15/15
100% Functions 6/6
100% Lines 30/30
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   3507×   3507× 3507× 3507× 3507× 3507× 3507× 3507× 3507× 3507× 3507× 3507×   617× 617×   3507× 3507×         1492×                 1492×       2015×                 2015×   3507×        
define(["require", "exports", "@syncfusion/ej2-popups", "../base/constant", "@syncfusion/ej2-base", "../base/classes"], function (require, exports, ej2_popups_1, events, ej2_base_1, classes) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var QuickPopupRenderer = (function () {
        function QuickPopupRenderer(parent) {
            this.parent = parent;
        }
        QuickPopupRenderer.prototype.renderPopup = function (type) {
            this.type = type;
            var baseClass = this.type === 'Inline' ? classes.CLS_QUICK_POP + ' ' + classes.CLS_INLINE_POP : classes.CLS_QUICK_POP;
            var baseId = this.type === 'Inline' ? '_Inline_Quick_Popup' : '_Quick_Popup';
            var popupId = ej2_base_1.getUniqueID(this.parent.getID() + '_' + type + baseId);
            this.popupElement = this.parent.createElement('div', { className: baseClass + ' ' + classes.CLS_RTE_ELEMENTS });
            this.popupElement.setAttribute('aria-owns', this.parent.getID());
            this.popupElement.id = popupId;
            var tip = this.parent.createElement('div', { className: classes.CLS_QUICK_TBAR_TIP_POINTER });
            this.popupElement.appendChild(tip);
            this.popup = this.createPopup(this.type, this.popupElement);
            return this.popup;
        };
        QuickPopupRenderer.prototype.quickToolbarOpen = function () {
            var args = this.popup;
            this.parent.trigger(events.quickToolbarOpen, args);
        };
        QuickPopupRenderer.prototype.createPopup = function (type, element) {
            var popup;
            switch (type) {
                case 'Inline':
                case 'Text':
                case 'Link':
                case 'Audio':
                    popup = new ej2_popups_1.Popup(element, {
                        viewPortElement: this.parent.iframeSettings.enable ? null
                            : this.parent.contentModule.getEditPanel(),
                        zIndex: 9,
                        collision: { X: 'fit', Y: 'flip' },
                        position: { X: 'left', Y: 'top' },
                        actionOnScroll: 'none',
                        open: this.quickToolbarOpen.bind(this)
                    });
                    break;
                case 'Video':
                case 'Image':
                case 'Table':
                    popup = new ej2_popups_1.Popup(element, {
                        viewPortElement: this.parent.iframeSettings.enable ? null
                            : this.parent.contentModule.getEditPanel(),
                        zIndex: 9,
                        collision: { X: 'fit', Y: 'flip' },
                        position: { X: 'left', Y: 'top' },
                        actionOnScroll: 'none',
                        open: this.quickToolbarOpen.bind(this)
                    });
                    break;
            }
            return popup;
        };
        return QuickPopupRenderer;
    }());
    exports.QuickPopupRenderer = QuickPopupRenderer;
});