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.

HTML to RichText (Slate.js)

default discord avatar
stfn77772 years ago
4

Hi everyone!,


I can try to import some posts from WP through local API but I have a problem with the content.


I don’t understand how can I convert HTML to RichText using slate.js. Someone could help me?

  • default discord avatar
    markatomniux2 years ago

    Hey

    @928376918804430868

    checkout the Payload github, they have a ton of good examples of Payload in action alongside Next.

    https://github.com/payloadcms/website/tree/main/src/components/RichText

    This is a pretty good example for the RichText Serializer

  • default discord avatar
    stfn77772 years ago

    Ok thank you but this is for "frontend" part, at the moment I try to import posts from WP so I have HTML and I need to transform into the RichText... Is there a way to do that?

  • discord user avatar
    jarrod_not_jared
    2 years ago

    It looks like you might be able to use this to do what you are asking:

    https://docs.slatejs.org/v/v0.47/other-packages/index

    Obviously you will want to test the input/output before running it on all of your data - but I think this would be an excellent starting point.

  • default discord avatar
    stfn77772 years ago

    Ok thank! you I will try it



    if you are interested, this serializer works:

    https://github.com/thompsonsj/slate-serializers

    It works in each convertion html to slate and slate to html

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.