How to preserve `/n` in sap.m.Text
See original GitHub issueFor <span>test \n\n\n test</span>
, it showed in page:
But for <Text text="test \n\n\n test"/>
, it showed as:
And \n
is not preserved in HTML:
As the doc said, I added renderWhitespace="true", maxLines="0"
:
renderWhitespace="false", maxLines="1"
:
What if I want to show “test \n\n\n test” ?
Failed to find design purpose for renderWhitespace
in https://github.com/SAP/openui5/blob/master/src/sap.m/src/sap/m/Text.js#L184
Issue Analytics
- State:
- Created 5 years ago
- Comments:16 (1 by maintainers)
Top Results From Across the Web
how do I display \n in sap.m.Text - SAP Community
1. change the control from sap.m.Text to sap.m.Label. 2. write a formatter for the text property to replace the escape ...
Read more >Text - Documentation - Demo Kit - SAPUI5 SDK
The Text control supports the rendering of new lines and the preservation of whitespace and tabs. Depending on whether you are using JavaScript...
Read more >How to add a line break to text in UI5? - Stack Overflow
In case the control sap.m.Text is used, keep in mind to enable the properties renderWhitespace and wrapping in order render the new lines...
Read more >Line break in sap.m.Text • Post • Neptune Software Community
Actually, it seems possible to have line breaks in a single instance of sap.m.Text by using '\r\n'. Using '\n' alone does not do...
Read more >Title - UI5 Web Components - SAP
None - The text will be truncated with an ellipsis. Normal - The text will wrap. The words will not be broken based...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
if enter new line at starting by pressing enter in TextArea then it removes the new line when we refresh the json model binded with TextArea . Please look into this issue
Issue is fixed in SAPUI5 version 1.56