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.

html-serializer, No serializer defined for node of type "line".

See original GitHub issue

Do you want to request a feature or report a bug?

Report Bug

What’s the current behavior?

Trying to build customer serializer rules for the slate-html-serializer but when I call

const html = new Html({ rules })
html.serialize(slateValue)

There is an error: “No serializer defined for node of type “line”.”

Comes from: https://github.com/ianstormtaylor/slate/blob/master/packages/slate-html-serializer/src/index.js#L364

What’s the expected behavior?

From my understanding, the default TEXT_RULE injected, should at least serialize leaf nodes as text if I have no rules defined. This would mean the nested nodes should all be dropped, which is OK, but it doesn’t even do that. It crashes.

I thought #2335 was similar, and tried to ask the question in Slack also.

More Info

I think the issue is that I call Plain.deserialize to create an initial value. Then I tried to serialize that as Html. The Plain deserializer introduces the unknown type. In my opinion this should just get ignored, but it somehow breaks the html serializer.

https://github.com/ianstormtaylor/slate/blob/a220cd5ae10c7e5f7df6d018deae0670526dbb73/packages/slate-plain-serializer/src/index.js#L17

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

6reactions
stevez86commented, Dec 3, 2019

@mattmazzola I think an example is what everyone is looking for. Would definitely help with the “learning curve”

2reactions
zeverocommented, Sep 11, 2019

I lost 2 hours with slate as well … I found out, that slate-html-serializer is not like slate-plain-serializer … it has first to be instantiated with rules: Html.(rules).serialize(value); BUT I did not find any rules, that I could use with the RichTextEditor Example.

Slate may be very powerful, but in its current state it is way tooo complicated to get something done.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTMLSerializer (Oracle WebLogic Server API Reference)
Implements an HTML/XHTML serializer supporting both DOM and SAX pretty serializing. HTML/XHTML mode is determined in the constructor.
Read more >
Protobuf-Net error message: No Serializer defined for type
I am getting the following error message when trying to serialize List<Tuple<string, Type, object>> : No Serializer defined for type: System ...
Read more >
org.apache.xml.serialize Class HTMLSerializer
Implements an HTML/XHTML serializer supporting both DOM and SAX pretty serializing. HTML/XHTML mode is determined in the constructor.
Read more >
ory-am/editor - Gitter
It was really just copying 6 lines and doing an import. Discordius ... Uncaught Error: No serializer defined for node of type "paragraph"....
Read more >
slate-html-serializer · Slate - thesunny1
To initialize an HTML serializer, you must pass it an array of rules, defining your schema. Each rule defines how to deserialize and...
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