AlessioGr / payload-plugin-lexical

Extends payload CMS with Meta's lexical RichText editor - a much more advanced and customizable richtext editor
MIT License
144 stars 6 forks source link

Deserialization Question #34

Closed swordensen closed 1 year ago

swordensen commented 1 year ago

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!

AlessioGr commented 1 year ago

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:

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!

swordensen commented 1 year ago

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 :)

AlessioGr commented 1 year ago

Alright!! I'll actually move it into a discussion, as it fits more there ^^