You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
As part of #1714shouldShow & 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:
Try rendering a <BubbleMenu editor={editor} /> component using TS.
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)
Explicitly setting shouldShow={null} and pluginKey="bubbleMenu" fixes the error
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?
Description
As part of #1714
shouldShow
&pluginKey
were added as required props toBubbleMenuPluginProps
.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:
<BubbleMenu editor={editor} />
component using TS.Type '{ editor: Editor; }' is missing the following properties from type 'Pick<BubbleMenuPluginProps, "pluginKey" | "editor" | "tippyOptions" | "shouldShow">': pluginKey, shouldShow ts(2739)
shouldShow={null}
andpluginKey="bubbleMenu"
fixes the errorCodeSandbox
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 makeshouldShow
&pluginKey
optional props inBubbleMenuPluginProps
or omit and redeclare them inBubbleMenuProps
?Environment?
"@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 👍
The text was updated successfully, but these errors were encountered: