This is a migrated thread and some comments may be shown as answers.

RadEditorStatistics off by One Character

2 Answers 77 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Rodney
Top achievements
Rank 2
Rodney asked on 01 May 2017, 11:59 AM

I'm using the EditorModule RadEditorStatistics and it always returns one less character than what has actually been entered in the text box. I'm not sure if it's the way I've implemented it or if that is just the way it works. Any help would be appreciated. I'm including the markup and js I use. Any help would be greatly appreciated.

<telerik:RadEditor ID="redJustification" runat="server" EditModes="Design"
        MaxTextLength="4000" SkinID="DefaultSetOfTools" ContentAreaMode="Div" OnClientInit="CharCountInit"
        Height="225px" Width="98%" Style="background-color: White; overflow: auto; display: block"
        Skin="Default" TabIndex="51">
        <Tools>
            <telerik:EditorToolGroup>
                <telerik:EditorSeparator />
                <telerik:EditorTool Name="Cut" />
                <telerik:EditorTool Name="Copy" />
                <telerik:EditorTool Name="Paste" />
                <telerik:EditorSeparator />
                <telerik:EditorTool Name="SelectAll" />
                <telerik:EditorTool Name="FindAndReplace" />
                <telerik:EditorSeparator />
                <telerik:EditorTool Name="AjaxSpellCheck" />
                <telerik:EditorSeparator />
            </telerik:EditorToolGroup>
        </Tools>
        <Modules>
            <telerik:EditorModule Name="RadEditorStatistics" />
        </Modules>
    </telerik:RadEditor>
function CharCountInit() {
    var originalRender = Telerik.Web.UI.Editor.Modules.RadEditorStatistics.prototype.render;
 
    Telerik.Web.UI.Editor.Modules.RadEditorStatistics.prototype.render = function () {
        originalRender.apply(this);
 
        this.get_editor().remove_selectionChange(this._onDoCountDelegate);
        this.get_editor().attachEventHandler("onkeydown", this._onDoCountDelegate);
    };
}

 

 

 

 

 

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 01 May 2017, 12:53 PM

Hi Rodney,

Replace the onkeydown event with the onkeyup one and this should fix the issue.

Best regards,
Rumen
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Rodney
Top achievements
Rank 2
answered on 01 May 2017, 03:49 PM
That worked great, thanks.
Tags
Editor
Asked by
Rodney
Top achievements
Rank 2
Answers by
Rumen
Telerik team
Rodney
Top achievements
Rank 2
Share this question
or