html-serializer, No serializer defined for node of type "line".
See original GitHub issueDo 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.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (6 by maintainers)
Top GitHub Comments
@mattmazzola I think an example is what everyone is looking for. Would definitely help with the “learning curve”
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.