How to format text submitted to ion-textarea, HTML/CSS


#1

Hello, my application has a ion-textarea tag to format text to include division to paragraphs for example? Here is what I mean: if I input the following text:

"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

The following text gets formatted like this:

“Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.”

Without the spaces. How can I include the spaces?


#2

Where does it get formatted like that? I’m assuming not in the textarea as it is being input, because I don’t see that happening. Are you displaying the text somewhere else? If so, how?


#3

Hi, can you show your html code please. It makes it easier for others to help.


#4

I bound a Preview area to the text area input, and styled the Preview area with white-space: pre-wrap. Then the user can see how the final content will appear in real time, much like the preview for posts on this forum.