You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by chris_flex <ck...@christiankiefer.de> on 2019/04/25 12:15:20 UTC

Huge space between list elements in RichText

I have imported some HTML:

var tff:TextFlow = TextConverter.importToFlow(getDescription(),
TextConverter.TEXT_FIELD_HTML_FORMAT);

and show that in a RichText, resulting in:

<http://apache-flex-users.2333346.n4.nabble.com/file/t605/problem.png> 

There are huge gaps - hope can they be adjusted?



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/

Re: Huge space between list elements in RichText

Posted by Carlos Rovira <ca...@apache.org>.
HI Chris,

if nothing is affecting that, it seems we have a problem there.
Hope others with more knowledge of TLF could give a hand here.

If there's a bug, you always can try to fix it and send us a PR to try it
and if valid merge in Flex SDK



El jue., 25 abr. 2019 a las 17:22, chris_flex (<ck...@christiankiefer.de>)
escribió:

> getDescription() =
>
> <p>Test</p>
> <ul>
> <li>1</li>
> <li>2</li>
> <li>3</li>
> </ul>
> <p>Test2</p>
> <ul>
> <li>*4*</li>
> <li>*5*</li>
> <li>*6*</li>
> </ul>
>
> is displayed:
>
> <http://apache-flex-users.2333346.n4.nabble.com/file/t605/test.png>
>
>
>
>
>
> --
> Sent from: http://apache-flex-users.2333346.n4.nabble.com/
>


-- 
Carlos Rovira
http://about.me/carlosrovira

Re: Huge space between list elements in RichText

Posted by Alex Harui <ah...@adobe.com.INVALID>.
The converter should produce a TextFlow.  I think there is some way to pretty-print the TextFlow.  Once we can see the TextFlow, hopefully we can identify what styles will control the spacing.

On 4/25/19, 12:44 PM, "chris_flex" <ck...@christiankiefer.de> wrote:

    It looks even worse with the StyleableTextField... 
    
    Is there any property/style, ... I should look for which could cause the
    problem in our App?
    
    
    
    --
    Sent from: https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-flex-users.2333346.n4.nabble.com%2F&amp;data=02%7C01%7Caharui%40adobe.com%7Caca199b46c514a5e997008d6c9b66ae0%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636918182676547010&amp;sdata=R9wpHZPV0pTogroPnx6%2F9EVGWERCbmDPHEzERXX9BNs%3D&amp;reserved=0
    


Re: Huge space between list elements in RichText

Posted by chris_flex <ck...@christiankiefer.de>.
Okay - I found the problem. I get the text from the server and somehow are \n
and \r added which I did not see in Intellij Idea.

var fixedString:String = explanation.getDescription().replace(new
RegExp('\\n', 'g'), '').replace(new RegExp('\\r', 'g'), '');

fixes it



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/

Re: Huge space between list elements in RichText

Posted by chris_flex <ck...@christiankiefer.de>.
It looks even worse with the StyleableTextField... 

Is there any property/style, ... I should look for which could cause the
problem in our App?



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/

Re: Huge space between list elements in RichText

Posted by Erik Thomas <er...@icloud.com>.
Another approach you might try is using StyleableTextField, which I use a lot in mobile apps for rendering html:

var textField:StyleableTextField = new StyleableTextField();
var styles:String = "p { leading: 2px; }"; // add all the css you need here
var styleSheet:StyleSheet = new StyleSheet();
styleSheet.parseCSS(styles);
textField.styleSheet = styleSheet;
textField.styleName = this; // inherit other styles from parent
textField.lineBreak = LineBreak.TO_FIT; // implicitly sets wordWrap to true
textField.percentWidth = 100;
textField.htmlText = yourHtml;
this.addElement(textField); // assumes this is a container like HGroup

Don't believe some posts that say you can't add StyleableTextField to containers, yes you can. And it's lighter weight than RichText which is not recommended for mobile apps anyway. Of course the renderer only supports a subset of html, but your example seems pretty simple and should work fine.



Re: Huge space between list elements in RichText

Posted by chris_flex <ck...@christiankiefer.de>.
getDescription() =

<p>Test</p>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
<p>Test2</p>
<ul>
<li>*4*</li>
<li>*5*</li>
<li>*6*</li>
</ul>

is displayed:

<http://apache-flex-users.2333346.n4.nabble.com/file/t605/test.png> 





--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/

Re: Huge space between list elements in RichText

Posted by Carlos Rovira <ca...@apache.org>.
Hi,

you should send the same structure of HTML (you can change real text for
dummy text) that you are using.
This can be just a problem of the inner HMTL structure you are using and
not something related to the flex code.

just figuring



El jue., 25 abr. 2019 a las 14:15, chris_flex (<ck...@christiankiefer.de>)
escribió:

> I have imported some HTML:
>
> var tff:TextFlow = TextConverter.importToFlow(getDescription(),
> TextConverter.TEXT_FIELD_HTML_FORMAT);
>
> and show that in a RichText, resulting in:
>
> <http://apache-flex-users.2333346.n4.nabble.com/file/t605/problem.png>
>
> There are huge gaps - hope can they be adjusted?
>
>
>
> --
> Sent from: http://apache-flex-users.2333346.n4.nabble.com/
>


-- 
Carlos Rovira
http://about.me/carlosrovira