I've run into a problem when it comes to designMode on FireFox. The script I got works like it should on webkit but have some wierd quirks when I try it out on FireFox.
What I'm trying to do is a Rich Text editor on the webapplication I'm building, I'm guessing that the problem lies in the fact that all DOM elements are generated inside the script and thus have problems syncing with the document on the go.
this is the code I use for generating the iframe and try to switch the designMode on (as I said, works fine in Chrome).
var container = document.createElement("div");
var parentElem = document.getElementById("portal-container-" + this.parent);
var textInput = document.createElement("textarea");
var textCanvas = document.createElement("iframe");
container.setAttribute("id", "wtedit-container-" + this.parent);
container.setAttribute("class", "wtedit-container");
textInput.setAttribute("id", "wtedit-textarea-" + this.parent);
textInput.setAttribute("parent", this.parent);
textInput.setAttribute("class", "wtedit-textarea");
textCanvas.setAttribute("id", "wtedit-textcanvas-" + this.parent);
textCanvas.setAttribute("name", "wtedit-textcanvas-" + this.parent);
textCanvas.setAttribute("class", "wtedit-textcanvas");
textCanvas.setAttribute("width", this.portalSettings.width);
textCanvas.setAttribute("height", this.portalSettings.height - 40);
container.appendChild(textInput);
container.appendChild(textCanvas);
parentElem.appendChild(container);
this.document = textCanvas.contentWindow.document;
this.document.designMode = "on";
I have a function that runs the last two lines that I can call from the console, and this seems to switch the designMode on when I run it in FireFox, but that's a really blunt way to go about, I want designMode to get active during the init process so that the application is ready to use as soon as the elements and logic is initialized!
So my question here is if there's some special considerations I need to think about when it comes to designMode and FireFox, is there a better way to access the document object that lies within the iframe object or something funky like that?
Thanx for any tips on the matter!
Cheers!
--
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.