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
20
Custom Dialog with Textbox not Inserting at Caret Position
posted

I followed the code example for a Custom Toolbar Dialog Button in the example given here to i followed myDialogButton2 to build a custom button on the tool bar. http://help.infragistics.com/Help/NetAdvantage/ASPNET/2012.1/CLR4.0/html/Infragistics4.WebUI.WebHtmlEditor.v12.1~Infragistics.WebUI.WebHtmlEditor.ToolbarDialogButton~Dialog.html

The issue is that when i click in the textbox of the dialog it inserts at the begining of the area instead of at the caret position in IE 9 and 10. if i leave the default value of the textbox it does insert at the caret position so it has something to do with clicking in the textbox and losing the caret position of the WebHtmlEditor. I have not tested in any other browsers but i saw on the form that someone else was having a simular issue and i don't know it was ever resolved. http://ko.infragistics.com/community/forums/t/63346.aspx 

I moved the javascirpt in that example to an exteral js file that is included and being called on the button click. i have also tried changing the .insertAtCaret() call to this below that i found in another code example with no success.

if (typeof iged_insNodeAtSel == "function")//Mozilla
        iged_insNodeAtSel(link);
    else
        iged_insText(link.outerHTML); // IE
  • 24497
    posted

    Hi Michael,

    Location of inserted text/object in IE depends on current selection of browser. Codes used by WebHtmlEditor are similar to following statement

    document.selection.createRange().pasteHTML(text).

    Since IE9 the functionality of selection/activation/focus in IE changed. Old selection in previous active element is not maintained and it gets reset after lost focus. That means that if end user changed focus (clicked on INPUT or similar element located outside of editing area of WebHtmlEditor), then selection/caret in WebHtmlEditor is lost and browser inserts text at different place (mostly at the beginning). Unfortunately WebHtmlEditor is not able to get around that feature of IE.