all files / modules/ rte.js

100% Statements 33/33
100% Branches 13/13
100% Functions 10/10
100% Lines 33/33
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   20× 20× 20× 20× 20×   33× 33×   30×   24× 23× 23×     23× 23×     21× 21×     32×   20×   387×        
define(["require", "exports", "@syncfusion/ej2-richtexteditor", "@syncfusion/ej2-richtexteditor", "./base-module"], function (require, exports, ej2_richtexteditor_1, ej2_richtexteditor_2, base_module_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var Rte = (function () {
        function Rte(parent) {
            this.compObj = undefined;
            ej2_richtexteditor_1.RichTextEditor.Inject(ej2_richtexteditor_1.HtmlEditor, ej2_richtexteditor_2.MarkdownEditor, ej2_richtexteditor_2.Toolbar, ej2_richtexteditor_2.Link, ej2_richtexteditor_2.Image, ej2_richtexteditor_2.QuickToolbar, ej2_richtexteditor_2.Table, ej2_richtexteditor_2.FileManager, ej2_richtexteditor_2.PasteCleanup, ej2_richtexteditor_2.EmojiPicker, ej2_richtexteditor_2.Audio, ej2_richtexteditor_2.Video, ej2_richtexteditor_2.FormatPainter, ej2_richtexteditor_2.Count);
            this.parent = parent;
            this.parent.rteModule = this;
            this.base = new base_module_1.Base(this.parent, this);
        }
        Rte.prototype.render = function (e) {
            this.compObj = new ej2_richtexteditor_1.RichTextEditor(this.parent.model);
            this.compObj.appendTo(e.target);
        };
        Rte.prototype.focus = function () {
            this.compObj.focusIn();
        };
        Rte.prototype.updateValue = function (e) {
            if (this.compObj && e.type === 'RTE') {
                this.parent.setProperties({ value: this.getRteValue() }, true);
                this.parent.extendModelValue(this.compObj.value);
            }
        };
        Rte.prototype.getRteValue = function () {
            var rteVal;
            if (this.compObj.editorMode === 'Markdown') {
                rteVal = this.compObj.contentModule.getEditPanel().value;
                return (rteVal === '') ? '' : rteVal;
            }
            else {
                rteVal = this.compObj.contentModule.getEditPanel().innerHTML;
                return (rteVal === '<p><br></p>' || rteVal === '&lt;p&gt;&lt;br&gt;&lt;/p&gt;' || rteVal === '') ? '' : rteVal;
            }
        };
        Rte.prototype.refresh = function () {
            this.compObj.refresh();
        };
        Rte.prototype.destroy = function () {
            this.base.destroy();
        };
        Rte.prototype.getModuleName = function () {
            return 'rte';
        };
        return Rte;
    }());
    exports.Rte = Rte;
});