getHTML does not preserve styling
See original GitHub issueDescribe 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:
- load editor with content
- get content via
getHTML()
- Set content via
setContent
with the retrieved HTML - Most styling will be lost
Expected 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.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
getHTML does not preserve styling · Issue #331 - GitHub
When loading a JSON based document, if it is later retrieved via getHTML() then reset to the editor content, most styling will be...
Read more >Get HTML with current styles (maybe inlined) of a page that ...
I need to get the HTML with current styles (maybe inlined) of a page that finished rendering and finished running scripts, using a...
Read more >html.parser — Simple HTML and XHTML parser ... - Python Docs
This parser does not check that end tags match start tags or call the end-tag handler for elements which are closed implicitly by...
Read more >HTML to filemaker - Claris Community
Hello everyone! I am barely trying to get an HTML formatted text to FileMaker from the FM19 rich text editor.
Read more >Styles and classes - The Modern JavaScript Tutorial
But we can safely use it for new elements, when we know we won't delete an existing style. The same can be accomplished...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@philippkuehn can you show us how to preserve custom styles???
That was actually an incredibly helpful response.
@ZolooAnzo @vortechron
See the above. This is a much more viable approach to tackling the problem.