Is it better to store JSON or HTML format in the database for Tiptap Editor? #6209
Unanswered
Dck126
asked this question in
Questions & Help
Replies: 1 comment
-
Storing the JSON, rather than HTML makes sure that any unique IDs or generated attributes on a Node/Mark will be retained. If you store HTML then it will regenerate all attributes again. It might not be important for your use-case but good to keep in mind. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I am using Hapi.js (BE) and Next.js (FE) with Tiptap as editor. I would like to ask for advice regarding the format of storing draft articles in the database:
Currently, I have two columns in the draft table:
draft-title - for the title of the article
draft-content - for the content of the article
Work Flow
1. JSON Option (Currently Used)
I store draft-title and draft-content in JSON format (output from editor.getJSON()).
When the article is published, I have to convert from JSON to HTML using the generateHTML() function.
The downside is that this process requires conversion every time the article is publicly displayed.
2. HTML Option (Alternative)
Store the HTML directly in draft-title and draft-content.
This way, I don't need any more conversions, and the editor directly handles the article in HTML format.
Main Question
In terms of performance and manageability, is it better to store in JSON or HTML in the database?
Do you have any best practices or experiences in handling storage formats in Tiptap Editor?
Thank you for your feedback!
Beta Was this translation helpful? Give feedback.
All reactions