Completed
Last Updated: 19 Feb 2015 15:58 by ADMIN
ADMIN
Ianko
Created on: 19 Feb 2014 07:58
Category: Editor
Type: Bug Report
0
Statistics module does not count correctly words under Firefox and IE
When a new line is entered (no matter which mode) the new lines does not break the text into separate words. 

To workaround this problem you can use the following get_text() method with the additional replacement logic:

<telerik:RadEditor runat="server" ID="RadEditor1">
</telerik:RadEditor>

<script type="text/javascript">
    Telerik.Web.UI.RadEditor.prototype.get_text = function()
    {
        var $T = Telerik.Web.UI;
        var modeEnum = $T.EditModes;
        var oContent = "";
        if (this.get_mode() != modeEnum.Html)
        {
            var oArea = this.get_contentArea();
            if (oArea)
            {
                if (oArea.innerText) {
                    oContent = oArea.innerText;
                }
                else {
                    oContent = oArea.innerHTML;
                    oContent = oContent.replace(/<br>/ig, "\r\n");
                    oContent = oContent.replace(/<\/p>/gi, "\r\n");
                    oContent = oContent.replace(/&nbsp;/gi, "\s");
                    if (this.get_newLineMode() === $T.EditorNewLineModes.Div) {
                        oContent = oContent.replace(/<\/div>/gi, "\r\n");
                    }
                    oContent = oContent.replace(/<\/?[^>]*>/ig, "");
                    oContent = oContent.replace(/<!--(.|\s)*?-->/gi, "");
                }
            }
        }
        else
        {
            oContent = this._getTextArea().value.replace(/<\/?[^>]*>/ig, "");
        }
        return oContent;
    };
</script>
3 comments
ADMIN
Joana
Posted on: 19 Feb 2015 15:58
The issue will be fixed in Q1 2015.
ADMIN
Ianko
Posted on: 19 Mar 2014 06:15
Make sure that the script block is placed right after the RadEditor's declaration in the markup
BMEA
Posted on: 18 Mar 2014 19:31
Getting error 
"ReferenceError: Telerik is not defined"