问题
I have this textArea
input field for blogPost
text content that may contain multiline text, like:
This is paragraph one.
(empty line)
This is paragraph two.
I will display it (when loading the blogPosts
in my App) inside a <p>
tag with white-space: pre-wrap;
How should I save this to Cloud Firestore?
What I've got so far:
I'm thinking about saving as JSON.stringify(textareaValue);
How can I do this? Any better options?
回答1:
Cloud Firestore will store exactly what you send it. If you need the string to be something different at the time you render it on screen (like converting newlines to <br>
), then you will have to make those modifications yourself.
来源:https://stackoverflow.com/questions/56564761/how-to-save-textarea-multiline-text-to-cloud-firestore