question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getHTML does not preserve styling

See original GitHub issue

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:

  1. load editor with content
  2. get content via getHTML()
  3. Set content via setContent with the retrieved HTML
  4. 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:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
vortechroncommented, Nov 15, 2019

@philippkuehn can you show us how to preserve custom styles???

0reactions
piboistudioscommented, Feb 6, 2022

it probably makes sense to use global attributes instead of modifying each extension.

That was actually an incredibly helpful response.

@ZolooAnzo @vortechron

See the above. This is a much more viable approach to tackling the problem.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found