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.

Trying to recreate the Slatejs mention example

default discord avatar
vaunblu3 years ago
11

I'm trying to implement the dropdown part of the mentions example from Slate's Examples:


https://www.slatejs.org/examples/mentions

I understand how to make a custom leaf to change my text blue and underline it, but I don't see how Slate's mentions example allows a dropdown list to appear with options when "@" is typed.

  • discord user avatar
    jmikrut
    3 years ago

    That would require some type of hooking into the

    onKeyDown

    command in Slate



    we have a roadmap item open to allow extending built-in Slate methods, but right now this will be kinda tough



    because we use the

    onKeyDown

    method, but we do not expose a way for you to "hook into it"



    we would happily accept a PR to be able to extend that method, but otherwise, this is on our roadmap and we will be tackling it soon

  • default discord avatar
    vaunblu3 years ago

    Ok perfect! Has the team looked into Tiptap and their rich text editor? They have a lot of out or the box extensions one could add



    It will personally be my first PR/contribution of github but I'm getting very familiar with the code base and our team is looking to use payload to handle the content for our 20+ client sites

  • discord user avatar
    jmikrut
    3 years ago

    Awesome!!



    I know

    @360823574644129795

    has built a custom rich text field that relies on Lexical, and you could do the same with TipTap

  • discord user avatar
    alessiogr
    3 years ago

    In fact lexical already supports mentions

    @1028003433090924695

    😉 Definitely recommend it over tiptap



    https://github.com/AlessioGr/payload-plugin-lexical
  • default discord avatar
    vaunblu3 years ago

    I will give this a look! Thank you

  • discord user avatar
    alessiogr
    3 years ago

    mentions arent configured to use payload users or something like that yet, but adding that shouldn't be too hard

  • default discord avatar
    vaunblu3 years ago

    I just need the to mention arbitrary variables I set so should be fine 👍



    @360823574644129795

    does npm work for the plugin or does it still have to be done manually?

  • discord user avatar
    alessiogr
    3 years ago

    Perfect! Currently it's just using this ^^



    npm doesn't work at the moment, so you'd need to add it to your project manually



    If you do wanna use it already - maybe wait a few hours or so. Just made some breaking changes to the link node, will push those soon

  • default discord avatar
    vaunblu3 years ago

    Ok I will standby 👍 Appreciate it

  • discord user avatar
    alessiogr
    3 years ago
    @1028003433090924695

    done! You can use it now 🙂

  • default discord avatar
    vaunblu3 years ago

    Sweet! I DM'd you a question on the plugin

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.