• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

whiteSpaceCollapse not working on textFlow created from HTML

Engaged ,
Jun 03, 2010 Jun 03, 2010

Copy link to clipboard

Copied

Is there a trick to getting whiteSpaceCollapse to work with imported HTML? Here's my current code, where value is HTML text (e.g. "<p>Blah</p>.."):

textFlow = TextConverter.importToFlow( value, TextConverter.TEXT_FIELD_HTML_FORMAT);

textFlow.whiteSpaceCollapse = WhiteSpaceCollapse.COLLAPSE;

I've also set whiteSpaceCollapse on the RichEditableText to "collapse" but I'm still noticing vertical space differences if my external HTML has linebreaks between <p></p> nodes. Many thanks in advance for any suggestions.

-Robert

TOPICS
Text layout framework

Views

4.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jun 04, 2010 Jun 04, 2010

Copy link to clipboard

Copied

WhiteSpaceCollapse is applied as part of the import.  After that changing it or modifying it has no effect.

Richard

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 15, 2011 Dec 15, 2011

Copy link to clipboard

Copied

And so ? How do we set the TextConverter to avoid collapsing white spaces on import now ?

I ve tried many ways but still no way to avoid a WEIRD behavior.
If I set spaces and I want to collapse them, then I can do it with a simple search/replace, there are plenty

of regex out there to do this.

I don't need the framework to behave strangely right ? So why did the flex engineers spend time

on putting together stuff that is totally weird ?
Plus the TextConverter has a lot of tlf_internal methods, just to avoid us to overload its functionnalities...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 15, 2011 Dec 15, 2011

Copy link to clipboard

Copied

Hi aliman,

Did you set format string to TextConvertr.PLAIN_TEXT_FORMAT ? That will preserve your spaces I think. 

var textFlow:TextFlow = TextConverter.importToFlow(markup, TextConverter.PLAIN_TEXT_FORMAT); 

And for tlf_internal, i just find one tlf_internal function in TextConverter. Others are public.

static tlf_internal function setFormatsToDefault():void

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 09, 2012 Apr 09, 2012

Copy link to clipboard

Copied

LATEST

this is the way to solve this bug and no need for changing any xml settings , simple and it works

exporting the textflow:

var richTextXML:xml = new XML("<"+"richTextXML"+"/>");

richTextXML.appendChild(getCdataXMl());

private function getCdataXMl():xml{

  var textFlowStr:String = TextConverter.export(textFlow,TextConverter.TEXT_FIELD_HTML_FORMAT

, ConversionType.STRING_TYPE).toString();

var textFlowXMl:xml = new XMl("<![CDATA["+textFlowStr+"]]>");

return textFlowXMl;

}

importing TextFlow from XMl :

var htmlTextInStr:String = richTextXMl.text();

var importtedTextFlow:TextFlow = TextConverter.importToFlow(htmlTextInStr,TextConverter.TEXT_FIELD_HTML_FORMAT);

textArea.textFlow = importtedTextFlow;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines