Describe the bug
When loading a JSON based document, if it is later retrieved via getHTML() then reset to the editor content, most styling will be lost. This is important because sometimes it is appropriate to convert to HTML to manipulate the HTML content before loading it back into the editor.
Steps to Reproduce / Codesandbox Example
Steps to reproduce the behavior:
getHTML()setContent with the retrieved HTMLExpected behavior
Tiptap should support at least switching between JSON and HTML on its own marks and nodes, but it would certainly be preferable for all direct properties in the style tag to be preserved.
ProseMirror doesn't lose styling. All HTML will be normalized as defined in toDOM of each node/mark.
For example all of them will be converted to a basic <strong>:
<p><strong>This is strong</strong></p>
<p><b>And this</b></p>
<p style="font-weight: bold">This as well</p>
<p style="font-weight: bolder">Oh! and this</p>
<p style="font-weight: 500">Cool! Right!?</p>
<p style="font-weight: 999">Up to 999!!!</p>
It's a feature to keep your stored HTML clean. If you want to support more stylings/attributes you have to define it in your schema. You can extend all extension or create your own, but I don't want to change this in the core at the moment.
@philippkuehn can you show us how to preserve custom styles???
Most helpful comment
@philippkuehn can you show us how to preserve custom styles???