No way to insert <tab/> in Flex RichEditableText flowlayout

162 Views Asked by At

I have some issue with this code :

<s:RichEditableText id="ta" width="100%" height="200" selectable="true" editable="true"/>

<fx:Script>
    <![CDATA[
var str:String = "some text<tab/>with tab";
ta.textFlow = TextConverter.importToFlow(str, TextConverter.TEXT_FIELD_HTML_FORMAT);
]]>
</fx:Script>

When running the text is show without space :

"some textwith tab"


Solved

I finaly find the solution:

var config:Configuration = Configuration(ta.textFlow.configuration);
var format:TextLayoutFormat = new TextLayoutFormat();
format.whiteSpaceCollapse = WhiteSpaceCollapse.PRESERVE;
config.textFlowInitialFormat = format;
ta.textFlow = TextConverter.importToFlow(str, TextConverter.TEXT_FIELD_HTML_FORMAT,config);
1

There are 1 best solutions below

0
On

Flex's "text field HTML format" only supports a subset of HTML tags:

anchor <a>
bold <b>
break <br>
font <font>
image <img>
italic <i>
list item <li>
paragraph <p>
text format <textformat>

You should get better results if you replace <tab /> with /t in your sample string.