Utility class or method that help determines TextConverter format to use
We currently create a TextFlow using the TextConverter.importToFlow method and either choose the TEXT_LAYOUT_FORMAT or TEXT_FIELD_HTML_FORMAT types of format based on the content of the String. The String can contain new TLF markup or the markup supported by the TextField.htmlText. We don't know what the content will be until runtime. I was wondering if there was a utility method or class that I could use that would create the TextFlow for me OR somehow parse the String to let me know which type of format to pass into the TextConverter.importToFlow method.
I'm currently doing the following, but would like something better if possible.
if ( content.indexOf("TextFlow") != -1 )
{
textFlow = TextConverter.importToFlow(content,TextConverter.TEXT_LAYOUT_FORMAT);
}
else
{
textFlow = TextConverter.importToFlow(content,TextConverter.TEXT_FIELD_HTML_FORMAT);
}
Thanks!
I see the TextFlowUtil class but it fails when my old HTML includes '<b>' and '<i>' tags which I guess falls under invalid markup. Just wondering if I'm missing something or doing the right thing.