Deserialization Question
Closed this issue · 3 comments
Hi guys,
I was able to get the plugin to work on the admin panel but, when it came to displaying the content I had a few questions.
The example referenced in the readme.md seems to indicate that we should be de-serializing the content manually but, Lexical has a build in read mode see: https://lexical.dev/docs/concepts/read-only
Do you think it's possible to generate a read-only lexical component based on the configuration provided to the admin panel and use that instead of de-serializing all the nodes?
I feel like this feature would add a huge advantage over the built in Slate system since de-serializing is hard and tedious.
thanks for your time and if you think it's a good idea please point me in the right direction and I can take a crack at it!
Hi guys,
I was able to get the plugin to work on the admin panel but, when it came to displaying the content I had a few questions.
The example referenced in the readme.md seems to indicate that we should be de-serializing the content manually but, Lexical has a build in read mode see: https://lexical.dev/docs/concepts/read-only
Do you think it's possible to generate a read-only lexical component based on the configuration provided to the admin panel and use that instead of de-serializing all the nodes?
I feel like this feature would add a huge advantage over the built in Slate system since de-serializing is hard and tedious.
thanks for your time and if you think it's a good idea please point me in the right direction and I can take a crack at it!
Hey, sure that would be possible! You have to consider two things:
- when using read-only mode, lexical handles the displaying. You have less freedom in how you want to display the content, compared to manually deserializing it, where you can specify every html element yourself. The exported html nodes are hard-coded in the lexical nodes.
- You have to include the lexical dependency in your front-end. You're free to do that, but it for sure would be bulkier and less performant than just deserializing it manually.
Personally, for those reasons, I would recommend read-only mode instead of de-serialization only if you want the users to edit the displayed content as well - right on the site. That's why facebook for example, is using it in read-only mode, while most blogs using it for their content are probably much better off de-serializing it. But you're defnitely free doing it either way!
One thing I'm not sure of, though: some nodes/plugins in this plugin depend on payload internals. E.g. the Upload/Image plugin requests the images from the payload upload collection, obviously. Or internal links. Not sure how that would play out in your front-end if it's decoupled from payload, you might have to modify those plugins/nodes. Test it out!
Cool! I'll see what I can come up with and I'll let you know if it's worth anything.
I'll close this issue in the meantime so it doesn't clog your queue :)
Alright!! I'll actually move it into a discussion, as it fits more there ^^