Problems with initializing designMode on a iframe document on script generated content.

Sunday, September 16, 2012

Hi folks!

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.

Copyright © 2010 Web Design | Free Blogger Templates by Splashy Templates | Layout by Atomic Website Templates

Vida de bombeiro Recipes Informatica Humor Jokes Mensagens Curiosity Saude Video Games Animals Diario das Mensagens Eletronica Rei Jesus News Noticias da TV Artesanato Esportes Noticias Atuais Games Pets Career Religion Recreation Business Education Autos Academics Style Television Programming Motosport Humor News The Games Home Downs World News Internet Design Entertaimment Celebrities 1001 Games Doctor Pets Net Downs World Enter Jesus Mensagensr Android Rub Letras Dialogue cosmetics Genexus lasofia thebushrajr wingshock tripedes gorduravegetal dainfamia dejavu-transpersonal jsbenfica republicadasbadanas ruiherbon iranianforaryans eaystcheyl fotosdanadir Só Humor Curiosity Gifs Medical Female American Health Madeira Designer PPS Divertidas Estate Travel Estate Writing Computer Matilde Ocultos Matilde futebolcomnoticias girassol lettheworldturn topdigitalnet Bem amado enjohnny produceideas foodasticos cronicasdoimaginario downloadsdegraca compactandoletras newcuriosidades blogdoarmario arrozinhoii