tinyMCE to AS3 htmlText

丶灬走出姿态 提交于 2019-12-04 20:21:45

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.

how to use this:

  • add legacyoutput to your plugins in the tinyMCE init function
  • add the following rule to your tinyMCE init function: extended_valid_elements : 'b,i'

Now your HTML will look like this:

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

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

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

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

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

First add the following to your config (this should result in using b-tags instead of strong for bold):

tinyMCE.init({
    ...
    formats : {
          ...
      bold : {inline : 'b'},
          ...
});

You should write an own plugin with the functionality to replaces your spans (using jQuery). The relevant code should look similar to this:

iframe_id = (ed.id == 'content_ifr') ? ed.id : ed.id+'_ifr';
spans = document.getElementById(iframe_id).document.getElementsByTagName('span');

for (i=0;i<spans.length;i++){

  with(document.getElementById(iframe_id).contentWindow){

    var font=document.createElement("font");
    font.innerHTML = span[i].innerHTML;
    font.size = $(span[i]).attr('font-size');
    font.color = $(span[i]).attr('color');
    span[i].parentNode.replaceChild(font, span[i]);
  }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!