Flex: RichTextEditor adds extra line before and after my text
-
04-07-2021 - |
Pregunta
I am using the RichTextEditor and couldn't find a way to resolve the below issue: I am getting an extra blank line above and below my text as in the image below:
This is what I get using RichTextEditor:
This is what I want using RichTextEditor:
How can I achieve the above results? Any pointer would be helpful.
Thanks.
More Info: Data is being loaded on from backend on the fly. Below is a sample for a similar TextFlow:
<TextFlow whiteSpaceCollapse=\"preserve\" version=\"2.0.0\" xmlns=\"http://ns.adobe.com/textLayout/2008\">\n <p>\n <span>Some School Name</span>\n </p>\n </TextFlow>
Solución
Ok. After some experiments, I got the answer OR at least the reason why it was happening.
If a textflow has been saved(serialized), And if you try to import it from a saved TextFlow string, then it adds this one extra line before your text. If you cast that string to XML and import it, it doesn't cause that blank line issue.
Below line has problem of one extra line before text:
ste.textFlow = TextConverter.importToFlow(textStr, TextConverter.TEXT_LAYOUT_FORMAT);
This line does not cause the blank line addition before text:
ste.textFlow = TextConverter.importToFlow(XML(textStr), TextConverter.TEXT_LAYOUT_FORMAT);