Skip to main content
Known Participant
June 6, 2011
Question

Extra Space in RichEditabletext with html text

  • June 6, 2011
  • 1 reply
  • 1123 views

I have a RichEditabletext control and feed it with html text similar to the below text.
<!--
          <br/>
          <font size="13" color="#000066">
             <b>
                <a name="b">B</a>
             </b>
          </font>
          <br/>
-->

In this case I got a space in front of the Character B. (" "B) They seems to show fine in browser,
 
Any Idea why the TLF put extra space in it?

Are we suppose to manually parse out all the extra "line feed"/"new line" before pass them to TLF control?

It's interesting that it rip out all the extra line but leave one space in it.

Thanks for any info.


This topic has been closed for replies.

1 reply

Adobe Employee
June 7, 2011

How do you feed RichEditableText with html?


I found that pure TLF works well as follows with SDK 4.5. RichEditableText is a kind of Sprite.

package
{
    import flash.display.Sprite;
   
    import flashx.textLayout.container.ContainerController;
    import flashx.textLayout.conversion.*;
    import flashx.textLayout.edit.EditManager;
    import flashx.textLayout.edit.IEditManager;
    import flashx.textLayout.elements.TextFlow;
   
    public class HTMLImporter extends Sprite
    {
        public function HTMLImporter()
        {
            var html:String = "<br/>"+
                "<font size=\"13\" color=\"#000066\">"+
                   "<b>"+
                      "<a name=\"b\">B</a>"+
                   "</b>"+
                "</font>"+
                "<br/>";
            var textFlow:TextFlow = TextConverter.importToFlow(html, TextConverter.TEXT_FIELD_HTML_FORMAT);
            textFlow.interactionManager = new EditManager() as IEditManager;
            var cc:ContainerController = new ContainerController(this, 200,1000);
            textFlow.flowComposer.addController(cc);
            textFlow.flowComposer.updateAllControllers();
        }
    }
}

jkc7297Author
Known Participant
June 7, 2011

Your test app is different because you already remove all the space between tag.

We have to display text readin from a html file.

Try creating a HTML file with the exact content I have in the last message.(With all the space and new line)

Read in that html file and send that to the RichEditabletext control.

Also try to just open the html file in a browser, you will notice the extra space in the RichEditabletext.

Thanks

Adobe Employee
June 8, 2011

TLF cannot just ignore or show all the space and linebreak, because TLF need a normalization process to ignore some mistakes occur in the markup and the normalization will never be totally complete.

RichEditableText use TLF in their code, and there are several ways you can feed RichEditableText with html text ,finally showing to you several results. According to my test, neat HTML text can give you exactly what you want. But I don't think it must be done manully. You can create your desired Regex Expression, right?