为什么 Flash/Silverlight/Whatever 中没有所见即所得的富文本编辑器?

发布于 2024-07-17 06:32:42 字数 636 浏览 17 评论 0原文

或者有吗?

从桌面软件开发人员的角度(也许与 Web 开发人员的角度相反)来看,丰富的 Web 应用程序平台(例如 Flash 或 Silverlight)看起来像是用于 Web 所见即所得文本编辑器的更好工具。 它们能够进行更复杂的输入/输出、数据表示等,并且它们在浏览器和平台上是一致的(好吧,也许还没有 Silverlight 和 Moonlight,但至少 Flash 看起来是)。

尽管如此,开发人员还是更喜欢使用 Javascript/DOM/HTML/CSS,尽管它们存在不兼容性、差异,辛勤地工作以解决每个特定的怪癖,并使用大量的 hack 来使这些技术发挥作用,也许从来没有达到最初的预期。能够做到。

有一些普遍接受的论据说明为什么不应在网站中使用 Flash,还有一个普遍接受的例外:嵌入式视频播放器。 富文本编辑器有何不同? “Flash 控件存在于其独立的沙箱中”——所见即所得编辑器普遍如此; “搜索引擎无法对 Flash 控件的文本进行索引”——无论如何,谁会关心对编辑器中不断变化的未保存内容进行索引? “并非所有用户都可能安装了 Flash” - 因此也并非所有用户都启用了 Javascript。

那么,问题来了:选择 Javascript 相对于 Flash 来实现所见即所得编辑器有哪些优势? 否则的话会有什么缺点?

Or are there?

From a desktop software developer point of view (as opposed, perhaps, to that of a web developer), rich web application platforms, such as Flash or Silverlight, look like better tools for doing WYSIWYG text editors for the web. They are capable of more sophisticated input/output, data representation etc., and they are consistent through the browsers and platforms (well, maybe not Silverlight and Moonlight yet, but at least Flash seems to be).

Still, the developers prefer to go with Javascript/DOM/HTML/CSS with all their incompatibilities, differences, toiling diligently to work around every particular quirk and using numerous hacks to make these technologies do what they were, perhaps, never originally supposed to be able to do.

There are some generally accepted arguments why you should not use Flash for a website, as well as a generally accepted exception: the embedded video players. How is a rich text editor different? "A flash control lives in it's isolated sandbox" - so, universally, does a WYSIWYG editor; "the text of a flash control can't be indexed by the search engines" - who cares about indexing the ever changing unsaved content of an editor, anyway; "not all users may have Flash installed" - so not all of them may have Javascript enabled, either.

So, here the question goes: what are the advantages of choosing Javascript over Flash for implementing a WYSIWYG editor? What would be the disadvantages of choosing otherwise?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

白昼 2024-07-24 06:32:42

与 Flash 编辑器相比,JavaScript 实现的 RTE 编辑器的主要优点是:

  • 您不需要 Flash 播放器即可使用
  • 大多数人没有关闭 JavaScript
  • 他们通常更富有并且拥有
    更好的功能
  • 附加功能,如嵌入式表格,
    可以提供图像和视频
  • 他们生成 HTML 输出,准备好
    用作网页内容

您想自己构建这个编辑器吗? 因为
一般来说,当今 javascript 中所见即所得编辑器可用的选择非常好。 检查例如: fckeditortinymce。 它们都非常令人印象深刻,并且随着每个版本的发布而不断改进,并且可以应用于广泛的场景。

在大多数现代浏览器中,通过 designmode/contenteditable div 和 iframe 来构建这些东西都有相当好的支持。 Flex 3 附带了一个还不错的 RichTextEditor ,会完成这项工作,但不是那么好。

The main advantages of a JavaScript-implemented RTE editor over Flash ones are:

  • You don't need Flash player to use
  • Most people do not have JavaScript turned off
  • They are generally richer and have
    better capability
  • Additional features like embedded tables,
    images and video can be offered
  • They produce HTML output ready to
    use as web content

Are you looking to build this editor yourself ? Because
generally speaking, the choices available for wysiwyg editors in javascript today are pretty darn good. Check for example: fckeditor and tinymce. they are all pretty impressive and improving with each release and can be applied in a wide range of scenarios

There is fairly good support via designmode/contenteditable divs and iframes in most modern browsers for building these things. Flex 3 comes with a merely okay RichTextEditor that'll do the job but isn't all that great.

打小就很酷 2024-07-24 06:32:42

主要原因(我认为)是使用 JavaScript (designMode) 在浏览器中进行丰富的 HTML 编辑已经有了现成的基础。 这是由 Microsoft 在 IE 5.5(据我记得)中开始的,然后被 Mozilla/Firefox、Opera 和 Safari 所采用。 浏览器将负责保存 HTML DOM 树,允许您导航和修改它等。您可以在浏览器中创建一个基本的(完全迟钝但仍然)HTML wysiwyg,几乎不需要 JavaScript 代码。 然后你可以在此基础上构建功能(大多数现代 javascript wysiwygs 已经做到了)。

在 Flash/Silverlight 中,开发人员必须从头开始并实现所有这些东西。 在这个领域很难与 Microsoft/Mozilla/Opera/等团队竞争。

The main reason (I think) is that there's a ready basis for doing rich HTML editing in the browsers using JavaScript (designMode). This was started by Microsoft in IE 5.5 (as far as I remember) and then picked up by Mozilla/Firefox, then Opera and then Safari. The browser would take care of holding the HTML DOM tree, allowing you to navigate and modify it, etc. You can create a basic (and totally retarded but still) HTML wysiwyg in browser with almost no javascript code. And then you can build features on to of that (what most of the modern javascript wysiwygs have done).

In Flash/Silverlight developer would have to start from scratch and implement all this stuff. And it's difficult to compete in this area with teams at Microsoft/Mozilla/Opera/etc.

人事已非 2024-07-24 06:32:42

对于 AS3,这里有一个非常好的免费的。

http://simplistika.com/as3-wysiwyg-rich-text-editor/< /a>

For AS3 here's a pretty good free one.

http://simplistika.com/as3-wysiwyg-rich-text-editor/

反差帅 2024-07-24 06:32:42

从技术上讲,没有什么说明您不能执行此任务,因为大多数基本 RTF 功能(即视觉功能)都已到位。 然而,也有一些限制,例如自动图像/文本回流(即,如果您分配图像并希望文本环绕它,这在某种程度上是数学+字符串+正则表达式操作的情况。并不容易。

您也可以使用 Silverlight 进行除渲染窗口本身(工具栏等,这将有助于解决丢失的图标,并提供比目前 JS 提供的更有限的异常处理控制),因为这将使您能够使用所见即所得窗口(它正在真正利用浏览器渲染)。引擎本身)和 Silverlight 来满足所有其他需求。

我们正在研究如何在未来版本中启用此功能,以便它不会被忽视。

Scott Barnes/Rich Platforms 产品经理/Microsoft。

Technically speaking there is nothing stating you can't perform this task as majority of the basic RTF capabilities - visual that is - are in place. There are limitations however, example being automatic image / text reflow (ie if you assign an image and want text to wrap around it, it's somewhat a case of math + string + regex manipulation. Not easy.

You could also use Silverlight for everything except the Rendered window itself (toolbars etc, which will help with missing icons and provide more finite control over exception handling than JS offers today). As this will enable you to do make use of the WYSIWYG window (which is tapping into really the browser rendering engine itself) and Silverlight for all other needs.

We're looking into how we can enable this functionality in future versions so it's not falling on deaf ears.

Scott Barnes / Rich Platforms Product Manager / Microsoft.

凝望流年 2024-07-24 06:32:42

JavaScript RTE 将成为 Web 标准,因为 contentEditable 包含在 HTML 5 W3 规范中。 JavaScript RTE 当前的方法是在文档属性中将 designMode 设置为“on”。 这样做的问题是整个文档变得可编辑,因此您会发现大多数 JavaScript RTE 通过 iFrame 加载编辑器,从而允许 iFrame 文档的 designMode 设置为“on”而不是父文档。

当前可用的 JavaScript RTE 的一个缺点是修改用于插入图像的用户界面非常复杂(如果这对您很重要)。 我个人并不关心很多内置界面,但据推测,如果您花了足够的时间阅读文档,您可以根据需要对其进行修改。 例如,在他们的演示中查看 TinyMCE 的插入图像功能,然后启动 WordPress 并查看他们如何修改它。 (WordPress 使用 TinyMCE)。

我还没有运行任何测试,但它只是“感觉”就像在动作脚本文本区域中输入似乎速度较慢。 我遇到的另一个问题是添加图像并在文章中移动它们的能力。 即使在 Adob​​e AIR 中,据说它也使用 WebKit 渲染引擎,因此我尝试使用 JavaScript 制作 RTE,它在 Safari 浏览器(也使用 WebKit)上运行良好,但是当通过 AIR 加载它时,它的行为有所不同。

总的来说,真正好的解决方案并不多,这与 contentEditable 尚未成为大多数浏览器的实现标准以及当前可用的 RTE 的脚本过于复杂有关。

对于 JavaScript RTE,请参阅:

TinyMCE、FCKEditor (CKEditor)、YUI 2 的编辑器,还有其他一些,如果您想自己动手,请查找有关 execCommand() 的教程,它基本上是修改所选元素或插入元素的 JavaScript 方法进入内容可编辑区域。

对于 Flash...我不知道,没有很多好的实现,甚至 Flex 文本编辑器也有点基本和有限。 对于这两个平台来说,主要缺点是修改和插入图像非常容易,因为做粗体文本或斜体等基本操作很简单。

JavaScript RTE's will become a web standard because contentEditable is in the HTML 5 W3 Specification. The current method for JavaScript RTE's is to set designMode to "on" in the document's attributes. The problem with this, is that the whole document becomes editable, therefor you will find most JavaScript RTE's load the editor through an iFrame, thus allowing the iFrame's document have designMode set to "on" and not the parent document.

A drawback to currently available JavaScript RTE's is how complex it is to modify the user interface for inserting images (if this is important to you). I personally don't care for a lot of the built in intefaces, but supposedly if you spent enough time reading the documentation you could modify it however you want. For an example, look at TinyMCE's insert image feature on their demo, and then fire up WordPress and see how they've modified it. (WordPress uses TinyMCE).

I haven't run any tests, but it just "feels" like typing in an actionscript textarea seems slower. Another problem I'm running into is the ability to add images and move them around in the article. Even in Adobe AIR, supposedly it uses the WebKit rendering engine, so I tried making a RTE using JavaScript, which works fine on the Safari browser (also uses WebKit), but when loading it through AIR it behaves different.

Overall, there are not a lot of really good solutions, this has a lot to do with contentEditable not being an implemented standard in most browsers (yet), and overly complex scripts for the currently available RTE's.

For JavaScript RTE's see:

TinyMCE, FCKEditor (CKEditor), YUI 2's Editor, and there are few others, if you want to roll your own, look for tutorials on execCommand() which basically is the JavaScript method that modifies selected elements or inserts elements into a contentEditable region.

For Flash... I don't know, there aren't a lot of good implementations, even the Flex Text Editor is kinda basic and limited. The main drawback and this is for both platforms, is how easy is it to modify and insert images, because doing basic things like bolding text or italicizing is simple.

老街孤人 2024-07-24 06:32:42

JavaScript 编辑器的主要优点是 JavaScript 为创建高级 html 元素(表格、水平线、有序列表和表单元素)提供了更多可能性。
然而,大多数编辑器都是使用设计模式和内容可编辑的 iframe 创建的。
这意味着代码的实际生成是由浏览器而不是 JavaScript 生成的。 每个浏览器可能会生成不同的 html,这可能是不需要的。

Flash 编辑器的功能较少,并且需要 Flash,但可能是 Flash 网站的完美解决方案。
javascript 编辑器中的 html 差异可能非常烦人,并且 flash-html 不支持的功能不应出现在该 javascript 编辑器中。 Flash 还生成其他在 html 中不使用的标记,例如: 标记仅在 flash-html/htmltext 中使用。

我遇到了这个问题,我找不到一个可以生成所有可能的 flash-html 且没有 javascript 编辑器问题的编辑器。
所以我自己创建了一个,可以在以下位置找到:
http://www.flashcomponents.net/component/hcs-rich-text -editor.html
它生成 flash-html,如果需要,还可以生成有效的 (x)html,在浏览器中没有任何差异。

简而言之,对于非基于 Flash 的网站,您可能需要一个 javascript 编辑器,因为它有更多的可能性。
对于 Flash 网站,您需要一个基于 Flash 的富文本编辑器来生成带有特殊标记(例如 .)的 flash-html 代码。

The main advantage of a javascript editor is that javascript offers a lot more possibilities for creating advanced html elements (tables, horizontal lines, ordered lists and form elements).
However most of those editors are created by using designmode and contenteditable iframes.
This means that the actual generation of code is happening by the browser and not by javascript. each browser might generate different html and that can be unwanted.

A flash editor has less capabilities and requires flash, but would probably be the perfect solution for flash websites.
The html differences in javascript editors can be very annoying, and features that flash-html doesn't support shouldn't be in that javascript editor. Flash also generates other tags which aren't used in html, for example: the <textformat> tag is only used in flash-html/htmltext.

I had this issue where i couldn't find an editor that generates all possible flash-html without the issues of a javascript editor.
So i created one myself which can be found at:
http://www.flashcomponents.net/component/hcs-rich-text-editor.html
It generates flash-html, and if needed also valid (x)html without any difference in browser.

So in short, for not-flash based websites you would probably want a javascript editor because it has more possibilities.
For flash websites you would want a flash based rich text editor to generate flash-html code with special tags like <textformat>.

旧时浪漫 2024-07-24 06:32:42

您在 Web 上发现大多数使用 Javascript 的主要原因是经济,大多数需要用户文本输入的网站(例如博客、论坛或 stackoverflow)都是用 HTML/Javascript 构建的。 因此,当您有能力的 JS 程序员构建 99% 的网站时,为什么要引入 Flash 程序员来构建其余 1%。

但这并不意味着它们不存在! 在一个较受欢迎的股票 Flash 网站上进行快速搜索后发现 3:

RTE1 | RTE2 | RTE3

这只是在 FlashDen 上。 搜索 FlashComponents.net 或 UltraShock.com,甚至只是用 google 搜索一下,我向您保证还有更多可供出售或免费下载的内容。

The main reason you find most of them on the web in Javascript is mostly economic, most sites that require user textual input (like blogs, forums, or stackoverflow) are built in HTML/Javascript. So when you have capable JS programmers building 99% of the site, why bring in a Flash programmer to build the other 1%.

But that doesn't mean they don't exist! A quick search on one of the more popular stock flash sites revealed 3:

RTE1 | RTE2 | RTE3

And that was just on FlashDen. Search FlashComponents.net or UltraShock.com, or even just google it and I guarantee you that there are many more for sale or for free download.

请你别敷衍 2024-07-24 06:32:42

Mindscape 为 Silverlight 制作了一个所见即所得的富文本编辑器:

http://www .mindscape.co.nz/products/SilverlightElements/controls/HtmlEditor.aspx

Mindscape make a WYSIWYG rich text editor for Silverlight here:

http://www.mindscape.co.nz/products/SilverlightElements/controls/HtmlEditor.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文