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

(React/TypeScript) BubbleMenu "shouldShow" & "pluginKey" props required #1779

Closed
RubenStoesser opened this issue Aug 23, 2021 · 0 comments
Closed
Labels
Type: Bug The issue or pullrequest is related to a bug

Comments

@RubenStoesser
Copy link

RubenStoesser commented Aug 23, 2021

Description
As part of #1714 shouldShow & pluginKey were added as required props to BubbleMenuPluginProps.

The BubbleMenu react component extends BubbleMenuPluginProps which currently forces the user to add these manually when rendering a <BubbleMenu /> component.

Steps to reproduce the bug
Steps to reproduce the behavior:

  1. Try rendering a <BubbleMenu editor={editor} /> component using TS.
  2. TS will throw an error: Type '{ editor: Editor; }' is missing the following properties from type 'Pick<BubbleMenuPluginProps, "pluginKey" | "editor" | "tippyOptions" | "shouldShow">': pluginKey, shouldShow ts(2739)
  3. Explicitly setting shouldShow={null} and pluginKey="bubbleMenu" fixes the error

CodeSandbox
I created a CodeSandbox to help you debug the issue:
https://codesandbox.io/s/tiptap-react-forked-97j2q?file=/src/App.tsx

Expected behavior
TS should not throw an error when omitting shouldShow & pluginKey as they are set by default anyway. As there are default values for these props via the plugin, it seems to just be a TS issue. Simplest solution would probably just be to make shouldShow & pluginKey optional props in BubbleMenuPluginProps or omit and redeclare them in BubbleMenuProps?

Environment?

  • tiptap version: "@tiptap/react": "^2.0.0-beta.61", "@tiptap/starter-kit": "^2.0.0-beta.98"

--

Cheers for this great library, been a pleasure to use so far 👍

@RubenStoesser RubenStoesser added Type: Bug The issue or pullrequest is related to a bug v2 labels Aug 23, 2021
andrewlu0 pushed a commit to trybaseplate/tiptap that referenced this issue Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug The issue or pullrequest is related to a bug
Projects
None yet
Development

No branches or pull requests

1 participant