The best way to store the data? #148
Replies: 9 comments
-
You store both. At some point you have to display the html version. If it is not persisted, the app has to parse the JSON version each and every time. Think of the html version as the read-only version. The JSON version is what you load into the editor or use for transformations. JSON and HTML are text. You can store oodles of it in the db until the cows come home. |
Beta Was this translation helpful? Give feedback.
-
It depends. For simple projects HTML should be fine. In our case at scrumpy we store JSON because we want to format the content in different ways, e.g. for emails (we built a PHP parser for it). |
Beta Was this translation helpful? Give feedback.
-
@philippkuehn Yeah, it really does depend on the use case. Storing the plain JSON obviously gives you more flexibility to generate the HTML afterwards and displaying it differently. Will you release the parser too? 👏 |
Beta Was this translation helpful? Give feedback.
-
I'll put it on GitHub! |
Beta Was this translation helpful? Give feedback.
-
It's still work in progress, but it's public now: |
Beta Was this translation helpful? Give feedback.
-
@hanspagel Awesome, thanks a bunch! |
Beta Was this translation helpful? Give feedback.
-
I'm working on publishing prosemirror-to-html (the other way around) too. |
Beta Was this translation helpful? Give feedback.
-
Sounds good. It could be nice to be able to convert the data all ways as you're mentioning. Something specific that you need help with? |
Beta Was this translation helpful? Give feedback.
-
Not really. We need to build those converters to migrate our WYSIWYG data to prosemirror/titap anyway. Just let me know if something is missing/broken if you're using it. |
Beta Was this translation helpful? Give feedback.
-
Just like the title states, which is the best data type to store, the JSON or generated HTML?
It's always best practice to store the users raw input, but storing both seems a bit overkill.
Thanks for the great work on the editor!
Beta Was this translation helpful? Give feedback.
All reactions