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
425
Insert text with custom dialog not at caret position
posted

Hi everyone,

I've created a custom  dialog for the WebHTMLEditor.
This dialog gives the functionality to insert a link from different resources (based on our CMS).

The dialog has different tabs with each its own content.
Most of the content contains asp lists with retrieved data (pages, forms, newsitems and such).

The lists are working perfect. An user selects some text and clicks on the insert link button on the WebHTMLEditor toolbar. The custom dialog pops up. The user clicks on a tab (e.g. Pages) and clicks in the list on the page which he/she wants to link at. The user then selects in a asp dropdown the target of the link and then clicks on the button "Insert" on the custom dialog and the selected text in the editor is replaced with the same text but now with a link value in the background to the selected page and target.

So far so good u think but now comes the problem in the following scenario:

When the users wants to insert a link to an external source, he or she clicks on a asp textbox in the custom dialog to fill in the link address and after that complete the steps as described above.

Problem: When the user clicks on the textbox, the selection in the WebHTMLEditor is gone and the caret returns to the start index (0)!
This causes the new link to be inserted at the start index of the WebHTMLEditor instead of replacing the selected text! 

This problems occurs in IE9 / Chrome.

Version: 2011.1