Hacker News new | past | comments | ask | show | jobs | submit login

quick question: I assume it ships(or supports a plugin) with a serializer to convert an editor state JSON to HTML. Does it depend on browser APIs to do so? Can it be somehow liberated out of native DOM APIs and language bindings for JSON-2-HTML in common languages like Java & Rust.

This could be a huge win for simple multi-platform rendering.




The EditorState is fully JSON serializable. You can use JSON.stringify in the browser, or an alternative on other platforms. You can then pass the stringified values around and parse them using `editor.parseEditorState()`


But, let's say I'd like to parse this stored state and send an email (as HTML) on the server?

My best guess is to use a NodeJS/V8 instance on the server to somehow transform JSON to HTML using Lexical's serializer (if something like that exists). Even this is tricky because it might depend on browser DOM apis for the conversion.

A better solution would be support language specific bindings to get HTML from JSON with zero dependecies.

Any chance you thought along these lines?


Yeah, I'd roll with Node/Deno and use Lexical that way. :)


There's no documentation on how you do that. I'm struggling with this exact point now


Deno




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: