tinyMCE至AS3 htmlText [英] tinyMCE to AS3 htmlText

查看:89
本文介绍了tinyMCE至AS3 htmlText的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用tinyMCE在Zend Framework后端中编辑/标记文本. 我想在Flash AS3应用程序中使用生成的HTML. 问题是Flash不支持<span><em>标签,<strong>标签等中的属性. 我猜这里有两种可能性:

I'm using tinyMCE to edit/markup text in a Zend Framework backend. I'd like to use the generated HTML in a Flash AS3 Application. The problem is that Flash doesn't support attributes in <span>'s, <em> tags, <strong> tags etc. I guess there are two possibilities here:

  • 更改tinyMCE配置,以便它使用字体标签而不是span的标签,<b>而不是<strong>,...
  • 使用正则表达式替换Flash中的所有HTML标记.
  • change the tinyMCE config so it uses font-tags instead of span's, <b> instead of <strong>,...
  • Replace all the HTML-tags in Flash with Regex.

任何帮助都将受到欢迎.

Any help would be welcome.

所以这是tinyMCE生成的原始html:

so this is the original html generated by tinyMCE:

<span style="color:#FF0000; font-size:24;">text, and <strong>bold text</strong></span>

这就是我在Flash中所需要的:

And this is what I need in Flash:

<font size='24' color='#FF0000'>text and <b>bold text</b></font> 

推荐答案

感谢您的答复,但我发现了一个非常简单的解决方案. TinyMCE带有一个名为 legacyoutput 的插件.这将生成Flash可读的老式HTML代码.

Thanks for the reply but I found a very simple Solution. TinyMCE comes with a plug-in called: legacyoutput. This will generate old-school HTML code that's readable in Flash.

如何使用它:

  • 在您的插件中添加 legacyoutput tinyMCE初始化函数
  • 将以下规则添加到您的 tinyMCE的初始化函数: extended_valid_elements:'b,i'
  • add legacyoutput to your plugins in the tinyMCE init function
  • add the following rule to your tinyMCE init function: extended_valid_elements : 'b,i'

现在,您的HTML将如下所示:

Now your HTML will look like this:

<font size="12" style="color:#FF0000"><b>text in bold 14pt red</b></font>

应将style属性替换为color属性,以使其在Flash中可读 您可以通过在legacyoutput js文件(tinymce/plugins/legacyoutput/editor_plugin.js和editor_plugin_src.js)中编辑规则来解决此问题:

The style attribute should be replaced by a color attribute to make it readable in Flash You can fix this by editing a rule in the legacyoutput js files (tinymce/plugins/legacyoutput/editor_plugin.js and editor_plugin_src.js):

查找"forecolor",并将代码更改为以下内容:

look for "forecolor" and change the code to the following:

forecolor : {inline : 'font', attributes : {color : '%value'}},

现在,您可以使用单个技巧在Flash中进行输出.

Now you can ouput this in Flash witouth using a single hack.

这篇关于tinyMCE至AS3 htmlText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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