I have added a javascript function to a custom button in the WebHtmlEditor which adds a logged on users name and the date and time as a time stamp using the insertAtCaret function.
Is there a way to move the caret to the end of the text before doing the insert?
Thanks
Paul
Hi Paul,
The WebHtmlEditor does not use internally similar action and does not have a public function to do that neither.
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. 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...