为 Flex & 提供 HTML 友好的 RichTextEditor 的建议空气? [英] Recommendations for an HTML-Friendly RichTextEditor for Flex & AIR?

查看:19
本文介绍了为 Flex & 提供 HTML 友好的 RichTextEditor 的建议空气?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为一个副项目,为了好玩",我分别在 Flex 和 AIR 中重写了我的博客和 CMS,虽然我对到目前为止的设计非常满意,但一个主要的痛点仍然是 (也就是说,对遗留的 HTML 内容执行 CRUD 操作,并在浏览器和 Flash 播放器中适当地呈现该 HTML 内容.当然,我可以使用开箱即用的 RichTextEditor 和 TextArea 控件,但两者都倾向于在显示和操作简单标记(例如,属性上的单引号或不存在引号、图像对齐等)及其内容时窒息默认情况下生成,虽然在 Flash 播放器中呈现精美,但在浏览器中通常看起来很可笑——这对我来说是一个重要因素,因为我想继续发布 RSS.

As a side project, for "fun," I'm rewriting my blog and CMS in Flex and AIR respectively, and while I'm pretty well satisfied with the design thus far, the one major pain point remains working with (which is to say performing CRUD operations on) legacy HTML content, and rendering that HTML content decently in both the browser and the Flash player. Sure, I can use the out-of-the-box RichTextEditor and TextArea controls, but both tend to choke on displaying and manipulating simple markup (e.g., single or absent quotes on attributes, image alignment, etc.), and the content it generates by default, while beautifully rendered in the Flash player, usually looks ridiculous in the browser -- an important factor to me, since I'd like to continue publishing RSS.

我知道那里有几个 RichTextEditor 衍生产品,但在开始使用它们中的任何一个之前,或者沿着手动操作内容的替代道路之前,我想我会先在这里投票,看看以前是否有人解决过这个问题;这似乎是一个相当普遍的用例.

I know there are a couple of RichTextEditor derivatives out there, but before heading down the road with any of them, or down the alternative road of manipulating the content manually, I figured I'd poll the group here first, to see whether anyone's tackled this problem before; it seems like it has to be a fairly common use case.

提前感谢您的见解!

推荐答案

您遇到的问题是 Flash 本身支持 非常小的 HTML 子集.因此,您为适应 Flash 播放器所做的任何编辑都会使其在 HTML 中呈现得更加原始.我个人认为,在 Flash 中编辑旧内容与在浏览器和 Flash 中清晰显示的冲突目标将很难解决.

The problem you've hit is Flash natively supports a very small subset of HTML. So any editing you do to fit the Flash player will make it render much more primitively in HTML. Personally I think the conflicting aims of editing legacy content in Flash and displaying cleanly in both Browser and Flash are going to be too difficult to resolve.

另一种选择是编写您自己的文本布局引擎,就像开发 Buzzword 的团队所做的一样.鉴于他们花了几个月的时间来制作他们的应用程序,我怀疑这大大超出了您的计划范围:)

One alternative would be to write your own text layout engine, much like the team working on Buzzword did. Given it took them many months to produce their application, I suspect this is massively out of scope for your plans :)

另一种更简单的替代方法是在 HTML 内容上应用服务器端转换器以将其简化为 Flash 级别.这将使您能够拥有布局丰富的 HTML 文档和更简单的 Flash 文档.但是它不会帮助您在 Flash 播放器中对其进行编辑.

Another, simpler alternative would be to apply a server side transformer over the HTML content to simplify it down to Flash level. This would enable you to have a richly layed out HTML document, and a simpler Flash document. However it won't help you edit it in the Flash player.

如果您想在 Flash 中编辑 HTML,您可以使用 Christophe Coenraets 和 由 Renaun Erickson 更新 为您提供双实时预览,但您仍然会遇到 Flash 和浏览器对 HTML 支持不同级别的问题.编辑文本字段以手动编辑然后预览您的内容确实不是您想要做的.

If you wanted to edit your HTML in Flash, you might be able to use the wmode + iFrame trick first mentioned by Christophe Coenraets and updated by Renaun Erickson to give yourself a dual-live preview but you are still going to have the problems with different levels of HTML support by Flash and Browser. And editing a textfield to manually edit-then-preview your content really isn't what you want to be doing.

最后一个选择是调查新的测试版文本布局框架,它将帮助您了解一些更广泛的 HTML 所见即所得部分.这看起来很复杂,但功能相当丰富.它适用于 Flex 3.2/Flex 4/Flash CS4.当然这是测试版,所以可能会在未来的某个时候改变.

A final option would be to investigate the newly-in-beta Text Layout Framework which would help give you some of the more extensive WYSIWYG parts of HTML. This looks a complicated but fairly feature rich. It works with Flex 3.2 / Flex 4 / Flash CS4. Of course this in beta, so may change at some point in the future.

顺便说一句,如果您正在构建一个 AIR 应用程序,使用现有的 JS+HTML 编辑器(例如 FCKEditor)构建一个 HTML+JS AIR 应用程序可能是一个可行的解决方案?然后,您只需为 Flash 播放器进行渲染(也许使用上面详述的转换器方法).

As an aside, if you are building an AIR application, perhaps building a HTML+JS AIR application using existing JS+HTML editors such as FCKEditor would be a viable solution? Then you would just have to render for the Flash player (perhaps using a transformer approach as detailed above).

这篇关于为 Flex & 提供 HTML 友好的 RichTextEditor 的建议空气?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆