Completed
Last Updated: 17 May 2021 12:39 by ADMIN
ADMIN
Vessy
Created on: 26 Jul 2017 15:11
Category: Editor
Type: Bug Report
0
The same fore/backcolor tool styles are applied to all Editors on the page in Lghtweight
When the fore/backcolor of the Editor is changed through its toolbar, the same color is set to all Editors on the page. The problem is reproducible in Lightweight rendering.

Video: https://www.screencast.com/t/YQ4OnNmu
1 comment
ADMIN
Rumen
Posted on: 17 May 2021 12:39

Hi there,

You can use the following solution to fix the problem:

<telerik:RadEditor ID="editor2" runat="server" RenderMode="Lightweight"></telerik:RadEditor>
<script type="text/javascript">
    if (typeof (Telerik.Web.UI.Editor) != "undefined") { 
        var $ = $telerik.$;
        Telerik.Web.UI.Editor.UI.LightweightColorPickerView.prototype.decorate = function (color) {
                var editorId = this.owner.get_parent().get_editor().get_id();
                var styleEl = $("head").find("style#re" + this.owner.get_name() + "_" + editorId + "_StyleHolder");
                if (!styleEl.get(0)) {
                    styleEl = $("<style></style>").attr("id", "re" + this.owner.get_name() + "_" + editorId + "_StyleHolder");
                    $("head").append(styleEl);
                }
                var content = "";
                if (color) {
                    content = "#" + editorId + " a.reToolIcon.reTool.re" + this.owner.get_name() + ":before{color:" + color + ";}";
                }

                try { //IE8 throws an error when setting innerHTML to a <style> element
                    styleEl.text(content);
                }
                catch (e) {
                    styleEl.prop("styleSheet").cssText = content;
                }
            }
    }
</script>

 

Regards,
Rumen
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.