Storing rich text in firebase

Viewed 2818

I have book summaries that I would like to show to users. What's the best way to store rich text in firebase to show to the user? Should I be using firebase database? I have a database with all the books and I was just going to create a column for the book summary text.

1 Answers

You need to convert the data to a format that can work in the database. This is really going to depend on your rich text editor.

For example, if you use Draft.js, there are functions convertToRaw and convertFromRaw.

Other formats, such as Markdown, is already in a format that can be stored in a database. Markdown is just a big text string.

Another possible option is to save your data in Base64. There are libraries for encoding and decoding Base64 depending on your source language.

Related