本文介绍了HTML WYSIWYG edtor:为什么可编辑内容在iFrame中移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么可编辑的html移动到iFrame?我分析了不同的编辑器(TinyMce,CKEditor等),并将所有可编辑内容移动到一个单独的iFrame,它们放置在原始文本之上。

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.

这个。我尝试了 contenteditable =true,这也是所有这些编辑器的基础,并没有找到一个理由还没有这样做。

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.

推荐答案

我是CKEditor核心开发人员。不是很长时间 - 只是在一年半的时间,但我了解了为什么我们使用iframed可编辑:)

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 :)


  1. 样式 - ifxted编辑器的内容不会继承网页的样式。这是非常重要的,因为我们不能重置样式(sic!CSS真的很糟糕)。

  1. 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.

只有在iframe可编辑的时候,我们才能在整个页面上使用head,metas,

Only in iframed editable we can work on entire page with head, metas, body styles, title, etc. Some of our users need this.

浏览器有很多缺陷(和不完全)的contenteditable。例如。猜测当你将列表粘贴到可编辑的是Firefox上的< h1> 元素时会发生什么(你可以在这个编辑器中检查 - )?它将泄漏出可编辑区域,并成为不可编辑的元素。我们必须在编辑器中手动处理这些情况,这是非常辛苦的工作:)

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 :).

我不确定这个, c $ c> designMode 允许将整个文档切换到可编辑区域已经是第一个, contenteditable 后来。

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.

可能有更多的理由为什么我们使用iframed可编辑的。我会更新我的答案,当我会学习他们:)

Probably there're more reasons why we use an iframed editable. I'll update my answer when I'll learn them :)

这篇关于HTML WYSIWYG edtor:为什么可编辑内容在iFrame中移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 20:55