Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firestore does not save line breaks from text area

I am using a text area with Vue v-model and saving it in a firestore collection. But the line breaks disappear in database.

How can it be fixed ?

<div class="form-group">
    <textarea v-model="docsInfo" rows="3"></textarea>
</div>
// ... JS
export default {
    data() {
        return {
          title: "",
          docsInfo: "",
        };
    },
// ...
db
    .collection("posts")
    .add({
      title: this.title,
      info: this.docsInfo // from text area
    })
like image 605
le0 Avatar asked Jan 05 '18 03:01

le0


1 Answers

The line breaks don't appear in Firestore console and the text is shown as a single line, but they are saved. Just apply the marked answer in the link below. Vue.js show white space (line breaks)

like image 126
le0 Avatar answered Oct 17 '22 16:10

le0