hello i added default lexical serializer to my payload project but have no idea where to call it?
can any one help me with this?
i have so bad connection due to Iranian government censorship so i uploaded the images somewhere else -_-
You should call the serializer in your frontend. It's meant to serialize the data of a lexical field to html.
What linobino1 said! An alternative solution would be serializing it directly in an AfterRead hook, so that you won't have to do it in the front end anymore / so that the frontend receives the full html string.
Just gotta make sure not to do that for admin panel visits & only for API calls though, as that would unnecessary slow down the admin panel
@DasMergo Is your front end React? If so this might help....https://gist.github.com/58bits/a6dc5d7d2f7297c6816deb2131835c14
It will be included in the Lexical plugin for Payload soon.
thanks for your response, I'm using the mighty 😄 NextJS
i think there is no difference for this purpose
It will be there as an example React serializer that you can use in any React frontend.
@DasMergo The example ReactSerializer can be found here...https://github.com/AlessioGr/payload-plugin-lexical/tree/develop/serialize-example
- although not 100% complete, it might help in getting started.
Get help straight from the Payload team with an Enterprise License.