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.

Custom leaf in slate editor

default discord avatar
ilyas771_last year
2

How to integrate custom leaf to slate editor? I have tried the one below



leaves: [


'bold',


'italic',


{


name: Leaf.name,


Button: Leaf.Button,


Leaf: Leaf.Leaf,


},


],


but it throws


Uncaught Error: The

useSlate

hook must be used inside the <Slate> component's context.


at useSlate (index.es.js:1659:1)


at Button (colorText.tsx:69:26)

  • default discord avatar
    markatomniuxlast year

    are you using the LeafButton provided by Payload? What does that code look like

  • default discord avatar
    ilyas771_last year

    so you need a single version of slate, just importing from payload/node_modules/slate will work

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.