This is similar but different question about how to set html in the selection of the iframe's editable content.
One sample found is: http://jsfiddle.net/HMRMv/1/, but it can also be used to show the problem.
On IE, in the sample if you select the text in iframe and then do the click, it will work. But after select the text in the iframe's editable content and than clicking on other pane, you will see the highlight disappear and the 'click' on the button will do nothing. Look like the:
var range = document.getElementById("iframe").contentWindow.document.selection.createRange();
Cannot get the previous selected range.
I tried cache the range in blur and reuse it at the 'click', but it does not work. Is it to do with iframe, any suggestion on this case?
var selectedType, selectedRange;
function onBlur(e) {
var selection = iframeElm.contentWindow.document.selection;
var range = selection.createRange();
selectedType= selection.type;
selectedRange = range;
}