all files / rich-text-editor/renderer/ content-renderer.js

100% Statements 31/31
100% Branches 6/6
100% Functions 9/9
100% Lines 31/31
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   1763×   1681× 1681× 1681× 1681×             1681×   1681×   1681× 1681× 1681× 1681×   2505×   89496×   577× 577×   1763×   31488×        
define(["require", "exports", "../base/util", "@syncfusion/ej2-base"], function (require, exports, util_1, ej2_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var ContentRender = (function () {
        function ContentRender(parent) {
            this.parent = parent;
        }
        ContentRender.prototype.renderPanel = function () {
            var rteObj = this.parent;
            var div = this.parent.createElement('div', { className: 'e-rte-content', id: this.parent.getID() + 'rte-view' });
            var rteContent = util_1.getEditValue(rteObj.value, rteObj);
            this.editableElement = this.parent.createElement('div', {
                className: 'e-content',
                id: this.parent.getID() + '_rte-edit-view',
                attrs: {
                    'contenteditable': 'true'
                }
            });
            if (!ej2_base_1.isNullOrUndefined(this.parent.fontFamily.default)) {
                this.editableElement.style.fontFamily = this.parent.fontFamily.default;
            }
            if (!ej2_base_1.isNullOrUndefined(this.parent.fontSize.default)) {
                this.editableElement.style.fontSize = this.parent.fontSize.default;
            }
            this.editableElement.innerHTML = rteContent;
            div.appendChild(this.editableElement);
            this.setPanel(div);
            rteObj.rootContainer.appendChild(div);
        };
        ContentRender.prototype.getPanel = function () {
            return this.contentPanel;
        };
        ContentRender.prototype.getEditPanel = function () {
            return this.editableElement;
        };
        ContentRender.prototype.getText = function () {
            var textString = this.getEditPanel().innerText;
            return textString === '\n' ? '' : textString;
        };
        ContentRender.prototype.setPanel = function (panel) {
            this.contentPanel = panel;
        };
        ContentRender.prototype.getDocument = function () {
            return this.getEditPanel().ownerDocument;
        };
        return ContentRender;
    }());
    exports.ContentRender = ContentRender;
});