Why is the editable html moved into an iFrame? I analysed different editors (TinyMce, CKEditor, etc) and all move the editable content into a separate iFrame which they lay over the original text.
What is the technical reason for this. I experimented with the contenteditable="true"
, which is the base of all this editors too, and didn't find a reason yet to do this.
WYSIWYG (pronounced wiz-ee-wig) is a type of editing software that allows users to see and edit content in a form that appears as it would when displayed on an interface, webpage, slide presentation or printed document.
There are two main varieties of HTML editors: text and WYSIWYG (what you see is what you get) editors.
I'm CKEditor core developer. Not for a long time - just for last half of the year, but I've learnt a lot about why we use iframed editable :)
Styling - content of the iframed editor doesn't inherit styles of the page. This is extremely important, because we cannot reset styles (sic! CSS really sucks). What's more - in iframe we can freely add our own styles which is helpful too.
Only in iframed editable we can work on entire page with head, metas, body styles, title, etc. Some of our users need this.
Browsers have very buggy (and incomplete) impls of contenteditable. E.g. guess what will happen when you paste list into the editable which is a <h1>
element on Firefox (you can check that in this editor - http://createjs.org/demo/hallo/)? It will leak out of editable area and become a non-editable element. We have to handle these cases manually in the editor and this is really hard work :).
I'm not sure about this but I believe that designMode
wich allows to switch entire document into the editable area had been first and contenteditable
came later. So the reason may be historical too - it's hard to switch from one approach to another.
Probably there're more reasons why we use an iframed editable. I'll update my answer when I'll learn them :)
From the tinymce froum
Hi Zappino!
It is the very nature of editors like TinyMCE to use an IFrame because in a frame you can modify any part of an HTML document to suit your needs without breaking anything in the main page's document. Especially if you want to edit a complete HTML document including the parts between and you won't be able to do so without an IFrame.
Cross Domain Skripting will occur if you store TinyMCE's files on a different (sub-)domain than the page from which you embed the editor. Show us a test scenario of your installation with which you are having trouble and someone might be able to help you out!
Greetings from Germany (back to Germany )
Felix Riesterer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With