Best way of rendering content of editor? #2455
|
What is the best approach of just showing the content of lexical that was written in administration to be shown in the client zone without the ability to edit it?
|
Replies: 3 comments 9 replies
|
There's really no definitive answer. It's whatever is best for your specific use case. The Lexical If client-side performance more of a concern though, you can build a separate "read-only" Lexical Editor which strips out any unnecessary plugins which are used in editing (e.g. For your specific use case, if you're display HTML which is saved in an admin panel elsewhere, you could just remove Lexical altogether on the client app and just render the saved HTML, though you would need to re-apply any custom styles. |
|
how to render json lexical from db to html on solidjs.
|
|
TWIMC I made a primitive example achieving lexical editorState JSON -> HTML rendering: https://github.com/vadimkantorov/lexical-cli-render (as a CLI tool) |
There's really no definitive answer. It's whatever is best for your specific use case.
The Lexical
readOnlymode on the editor is the easiest way to show serialized HTML or JSON editor state.If client-side performance more of a concern though, you can build a separate "read-only" Lexical Editor which strips out any unnecessary plugins which are used in editing (e.g.
OnChangePlugin).For your specific use case, if you're display HTML which is saved in an admin panel elsewhere, you could just remove Lexical altogether on the client app and just render the saved HTML, though you would need to re-apply any custom styles.