cancel
Showing results for 
Search instead for 
Did you mean: 

RichTextEditor binding issue

muhsin_panakkal
Participant
0 Kudos

Hai Experts,

I am using Richtext Editor in one of my SAPUI5 app, while loading the app value is binding properly, but sometime the value is not binding(rare scenarios) since the odata is returning the required data, Is anybody face the same issue..? If Yes can anybody assist to resolve the same.

Thanks,

Muhsin

View Entire Topic
M_Zimmermann
Explorer
0 Kudos

artiom21 Yes, I found a workaround.

The RichTextEditor uses the TinyMCE library internally. Since SAPUI5 1.60 a newer version of TinyMCE (4.7.13) is used which is causing this problem. The version of TinyMCE (4.5.7) used in SAPUI5 1.52 works fine. For this reason I created a custom control which is using the older version of TinyMCE:

CustomRichTextEditor.js:

sap.ui.define([
    "sap/ui/richtexteditor/RichTextEditor",
    "sap/ui/dom/includeScript"
], function (RichTextEditor, includeScript) {
    "use strict";

    RichTextEditor.loadTinyMCE = function () {
        var sLocation = "https://sapui5.hana.ondemand.com/1.52.41/resources/sap/ui/richtexteditor/js/tiny_mce4/tinymce.min.js";

        if (sLocation) {
            var sRealLocation = sLocation,
                oScriptElement = document.querySelector("#sapui5-tinyMCE"),
                sLoadedLocation = oScriptElement ? oScriptElement.getAttribute("src") : "";


            if (sRealLocation !== sLoadedLocation && RichTextEditor._iCountInstances === 1) {
                delete window.tinymce;
                delete window.TinyMCE;
                RichTextEditor.pLoadTinyMCE = null;
            }

            if (!RichTextEditor.pLoadTinyMCE) {
                RichTextEditor.pLoadTinyMCE = new Promise(function (fnResolve, fnReject) {
                    includeScript(sRealLocation, "sapui5-tinyMCE", fnResolve, fnReject);
                });
            }
        }
        return RichTextEditor.pLoadTinyMCE;
    };

    return RichTextEditor;
});

CustomRichTextEditorRenderer.js

sap.ui.define([
    "sap/ui/richtexteditor/RichTextEditorRenderer"
], function (RichTextEditorRenderer) {
    "use strict";

    return RichTextEditorRenderer;
});

Essentially I only override one method which specifies the version of TinyMCE. Currently I use this custom control in SAPUI5 1.60 which works fine but have not tested it for newer versions.

I hope that helps you 🙂