Hi folks,
I have created a plugin which, when its toolbar button is clicked, brings up a modal dialog asking user to input some data.
When the dialog's OK button is clicked, the onClick handler uses the data in the dialog to call another function which (1) focus()es the editor, (2) calls editor.getSelectedHtml() -- this is a function whose source was given in a previous forum posting by garry.yao -- to grab the markup represented by the currently selected editor text, (3) builds a markup string consisting of the selected HTML surrounded by a specially classed/attributed div, and (4) calls editor.insertHtml(), passing the markup string as an argument.
This has the effect of replacing the selection with my div-wrapped version. Works great in Chrome 8 and Firefox 3.6. In IE8, rather than replacing the selection, it leaves the selection alone and puts the div-wrapped version at the beginning of the text editor!
What should I do to ensure that I'm replacing the selection in all browsers?
I have created a plugin which, when its toolbar button is clicked, brings up a modal dialog asking user to input some data.
When the dialog's OK button is clicked, the onClick handler uses the data in the dialog to call another function which (1) focus()es the editor, (2) calls editor.getSelectedHtml() -- this is a function whose source was given in a previous forum posting by garry.yao -- to grab the markup represented by the currently selected editor text, (3) builds a markup string consisting of the selected HTML surrounded by a specially classed/attributed div, and (4) calls editor.insertHtml(), passing the markup string as an argument.
This has the effect of replacing the selection with my div-wrapped version. Works great in Chrome 8 and Firefox 3.6. In IE8, rather than replacing the selection, it leaves the selection alone and puts the div-wrapped version at the beginning of the text editor!
What should I do to ensure that I'm replacing the selection in all browsers?