R
Rauan Maemirov
Hi, I'm coding smth like wysiwyg-editor and stumbled upon some
obstacles.
var iDoc = $(this.wysiwyg.contentWindow.document);
var sel = (iDoc.selection) ? iDoc.selection :
this.wysiwyg.contentWindow.getSelection();
if (Prototype.Browser.IE) {
var rng = sel.createRange();
rng.pasteHTML(html);
} else {
// Firefox and opera code
}
So, in this code I'm inserting html to the iframe (with
contentEditable/designMode = true/on ).
Where this.wysiwyg = $('iframe'). //dynamically created iframe
In IE it doesn't insert html to iframe, but to the top of my main
document, right after the <body> tag.
The reason is I'm clicking on link and div appears (Google Docs link
inserting style). So iframe looses
focus. But in firefox it doesn't. Maybe there are any ways how to
remember previous focus position?
obstacles.
var iDoc = $(this.wysiwyg.contentWindow.document);
var sel = (iDoc.selection) ? iDoc.selection :
this.wysiwyg.contentWindow.getSelection();
if (Prototype.Browser.IE) {
var rng = sel.createRange();
rng.pasteHTML(html);
} else {
// Firefox and opera code
}
So, in this code I'm inserting html to the iframe (with
contentEditable/designMode = true/on ).
Where this.wysiwyg = $('iframe'). //dynamically created iframe
In IE it doesn't insert html to iframe, but to the top of my main
document, right after the <body> tag.
The reason is I'm clicking on link and div appears (Google Docs link
inserting style). So iframe looses
focus. But in firefox it doesn't. Maybe there are any ways how to
remember previous focus position?