Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
265
Issues with placing mouse cursor at text end when having huge data inside webhtmleditor
posted

We are having issues while clicking using mouse at the text end of webhtmleditor control, especially when control is loaded with huge html data.

I have tried using javascript to set cursor position to text end on webhtmleditor focusin event but it alwasy gives me error at the following line [text.createTextRange(); It says undefined], but if i use this with normal textbox it works fine.

I tried different properties of text range, nothing seems to work with this control. Please suggest if u have any better solution

function SetCursorToTextEnd()
    {   
        var editor = iged_getById('<%=panelTo.ClientID%>');
        var text = editor._ie ? editor._elem : editor._doc().body;
       
        //alert(text.innerText);
        if (text != null && text.innerText.length > 0)
        {
            //if (text.createTextRange)
            //{
                var FieldRange = text.createTextRange();
                FieldRange.moveStart('character', text.innerText.length);
                //FieldRange.moveEnd('character', text.innerText.length);
                FieldRange.collapse();
                FieldRange.select();
            //}
        }       
    }

We are populating SPAN Html controls inside webhtmleditor.

example: webHtmlEditor1.Text = "<span id='I_1' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 1</span>;"; etc...


Parents
No Data
Reply
  • 12004
    posted

    Hello Sai,

    This is just a follow up on the thread if you have any questions in regards to calling document.createRange(). In the attached sample demonstrates on moving the cursor at the end of the WebHtmlEditor's content.

    Let me know if you have any questions with this matter. Thank you.

Children