thompsonsj/slate-serializers

HTML rendering quirks

Closed this issue · 3 comments

Hi!

It's good to see this package started. We built an editor based on Slate, we had to solve the same problems you're doing here. Your code looks great!

I want to point you also to https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Whitespace it's a document which would have saved me a lot of trouble, if I'd have known about it in time. Also, we had a lot of issues with the fact that Firefox and Google Chrome behave differently when copying/pasting content. Firefox preserves the original HTML that's copied, while Chrome reformats it to a "normalized, wysiwyg version".

@tiberiuichim thank you! That's really helpful - I've been struggling with how to handle whitespace. I'm going to keep this issue open until I have something reasonable.

Also, it's reassuring to see the same struggles. I can relate with the following comment!

https://github.com/plone/volto/blob/4e619b73bda70c4b0e52a2fb48048bc11e6f0484/packages/volto-slate/src/editor/deserialize.js#L158-L161