Completed
Last Updated: 04 Sep 2019 15:13 by ADMIN
ADMIN
Danail Vasilev
Created on: 12 Aug 2013 15:41
Category: Editor
Type: Bug Report
0
FIX RadEditor's Statistics Module localization when ajaxified with RadAjaxPanel in MasterPage scenario under IE
When multiple instances of RadEditor are placed inside hidden ASP Panel (visible='false') which is ajaxified with RadAjaxManager/RadAjaxPanel, and then the visibility of the ASP Panel is switched to true, the Statistics Module of the second, third.. Editors display 'undefined'. The issue is observed under Internet Explorer.

The workaround is to use:

-either ASP:UpdatePanel instead of the RadAjaxManager/RadAjaxPanel

-OR use the following JavaScript override:

            Telerik.Web.UI.Editor.Modules.RadEditorStatistics.prototype.doCount = function () {
            
                if (!this.get_visible()) return;

                var content = this.get_editor().get_text();

                var words = 0;
                var chars = 0;
                if (content) {
                    var punctRegX = /[!\.?;,:&_\-\–\{\}\[\]\(\)~#'"]/g;
                    content = content.replace(punctRegX, "");
                    var trimRegX = /(^\s+)|(\s+$)/g;
                    content = content.replace(trimRegX, "");
                    if (content) {
                        var splitRegX = /\s+/;
                        var array = content.split(splitRegX);

                        words = array.length;

                        var newLines = /(\r\n)+/g;
                        content = content.replace(newLines, "");
                        chars = content.length;
                    }
                }

                var elem = this.get_element();
                elem.innerHTML = "<span style='line-height:22px'>" + "Words:" + " " + words + "   " + "Characters:" + " " + chars + " </span>";
            }

In order to make the above function override working, it must be placed:

-Either below the RadScriptManager and load all the necessary resources through ScriptReferences of the RadScriptManager (disable the embedded resources of the RadEditors' instances too)

-OR create an additional instance of RadEditor in a hidden div, outside the AjaxPanel and place the function override below it.

1 comment
ADMIN
Rumen
Posted on: 04 Sep 2019 15:13
Not reproducible in R2 2019 (version 2019.2.514).