Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow users to pass a custom findSuggestionMatch to Suggestion plugin #4515

Merged

Conversation

estrattonbailey
Copy link
Contributor

@estrattonbailey estrattonbailey commented Oct 9, 2023

Please describe your changes

Hey there 👋 we're using Tiptap and the Suggestions plugin to implement hashtags in our editor. Our hashtag validation is a little more complex than what the default findSuggestionMatch allows, so I started investigating how I could replace the matching with a custom version. This seemed to be the most straightforward approach.

Disclaimer: this might be more of a conversation starter than a fix, but fwiw it does work for my needs right now. Happy to help improve.

How did you accomplish your changes

Just added a new property findSuggestionMatch to the Suggestion plugin, with types that match the built-in function.

How have you tested your changes

Just manually integrating at the moment, but lmk if I can assist with a test suite.

How can we verify your changes

I think it's straightforward.

Checklist

  • The changes are not breaking the editor
  • Added tests where possible
  • Followed the guidelines
  • Fixed linting issues

Related issues

N/A

@netlify
Copy link

netlify bot commented Oct 9, 2023

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit 76b8a29
🔍 Latest deploy log https://app.netlify.com/sites/tiptap-embed/deploys/65574dbe8dac51000829d445
😎 Deploy Preview https://deploy-preview-4515--tiptap-embed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@bdbch bdbch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. @svenadlung ?

@svenadlung
Copy link
Contributor

Looks good to me. Thank you so much for your contribution @estrattonbailey.

I think we could add the new prop to the docs as well: https://tiptap.dev/api/utilities/suggestion

Btw: I just see that the allow prop is not documented there either 🥲

@estrattonbailey
Copy link
Contributor Author

Thanks for the quick review! I added to the docs, feel free to edit.

I'm not 100% on what allow does so I'll leave that to y'all.

@estrattonbailey
Copy link
Contributor Author

Hey @svenadlung 👋 just wanted to bump this in case it got lost in the shuffle 😄

@svenadlung
Copy link
Contributor

Awesome, thx. LGTM.

@estrattonbailey
Copy link
Contributor Author

Hey @svenadlung 👋 no particular rush on my end, but any chance we can get this merged and released soon-ish? Thanks for your help!

@estrattonbailey
Copy link
Contributor Author

Hey @svenadlung just bumping this again :) thanks!

@janthurau janthurau self-assigned this Nov 17, 2023
@janthurau janthurau force-pushed the allow-custom-suggestion-matching branch from 8b0c991 to 76b8a29 Compare November 17, 2023 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants