BlockNote
BlockNote copied to clipboard
Storing of output data
Blocknote is an amazing editor, I loved the ui and how it was easy to setup but right now there's no good way for storing the output data, be it raw json, html or markdown.
- If you try to store in markdown there is complete loss of indentation, alignment, colors etc.
- If you try to store it in HTML, the output instead of using the
styleprop usesclassprop which would definitely make it harder to adapt with custom components. - Storing data in json is absolutely is no go since there's no way to actually convert it to html or markdown at a later point with utility functions.
Possible solutions -
- Markdown output will always have lossy output, there's no way to fix this except for using inline HTML.
- For HTML, it should use the
styleprop rather than using customclassprop. - Storing the raw data can be extremely helpful if there's an way to convert the blocks to HTML without initialisation of a editor.
Basic styles like bold, italic, etc should be getting serialized to HTML correctly already, but color styles and text alignment information is removed. I think fixing this would be a good improvement.
Thanks @Oreki-Dev for the clear description.
I understand that your use-case is: (a) you want to serialize and deserialize content to/from a database. (b) you want to display render the content as HTML (probably on the backend?), without rendering an entire editor on the client.
a) is currently supported, but b) not very well, because the HTML is kind of "lossy". I think this makes a lot of sense and should be a very common use-case, for example if you use BlockNote as an editor inside a CMS - where you want to have the editor in the admin panel, and then use the HTML version of the written content for pages of the website (that visitors see).
Let me know if we understand the use-case correctly. I agree this would require extra work on the HTML export function, and a function that can also be run server-side without loading the entire editor
cc @matthewlipski
Hello @YousefED, yes you've more or less understood my use-case, I'm actually building a content platform (blog to be precise) and I would love to store the output as raw JSON but that would only be possible if
- It is possible to convert data from/to JSON/HTML/MD without initialisation of an actual client
- The HTML output uses
styleprop instead ofclassprop
However beside this issue I've loved it and I would love to keep up with the updates and probably use it in the future as well Thank you!