Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Not all fields of lexical editor block available in API

default discord avatar
ammar53255 months ago
6

Can some one help me?



Hello

  • default discord avatar
    erichier9 months ago

    Thank you so much! :) I'll give that a try

  • discord user avatar
    alessiogr
    9 months ago
    in cases where I use the blocks only in a localized richText field, I can just omit the localized field and everything will work as expected?

    Exactly! Omit it from any field & sub-field


    And the localisation will still work as the base richText field is localized, right?

    Yep! If any parent is localized, in this case the richText field, the localization property of sub fields will not have any effect anyways (outside of this lexical bug where it breaks)

  • default discord avatar
    erichier9 months ago

    Thank you for your answer,

    @360823574644129795

    !



    This means in cases where I use the blocks only in a localized richText field, I can just omit the localized field and everything will work as expected? And the localisation will still work as the base richText field is localized, right?

  • discord user avatar
    alessiogr
    9 months ago
    @214300333470515210

    you will have to remove

    localized: true

    from any block fields / sub fields within lexical blocks. Having that property set will make them vanish from the API response.



    This was a bug and has been fixed in the latest 3.0 beta version (

    https://github.com/payloadcms/payload/pull/6489

    ). If those same blocks/fields are shared & used in other places within payload, and you cannot remove localized: true, I recommend making a utility function which automatically strips

    localized: true

    from those fields

  • discord user avatar
    seanzubrickas
    9 months ago
    @360823574644129795

    could you take a look at this one when you have a minute?

  • default discord avatar
    erichier9 months ago

    I have an issue with a custom block type in the lexical editor. The block type contains richText fields that are just not present in the result returned from the API. Concretely, I have a cards module that has three rich text fields. Other fields of the card however are present in the response. Please look at the attached images of the post and the API response.



    If you need the code, I already threw away a lot of what we had in the repo so that it is very close to a minimal sample. We have payload version 2.13.0 and

    @967091941873426493

    /richtext-lexical version 0.10.0 in our package.json.

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.