fix: make shouldShow and pluginKey option for menus, fix #1779

This commit is contained in:
Philipp Kühn
2021-08-23 18:44:40 +02:00
parent 1618e8ee85
commit 70a328bd3d
4 changed files with 16 additions and 12 deletions

View File

@@ -13,7 +13,7 @@ export interface BubbleMenuPluginProps {
editor: Editor,
element: HTMLElement,
tippyOptions?: Partial<Props>,
shouldShow: ((props: {
shouldShow?: ((props: {
editor: Editor,
view: EditorView,
state: EditorState,
@@ -140,7 +140,7 @@ export class BubbleMenuView {
const from = Math.min(...ranges.map(range => range.$from.pos))
const to = Math.max(...ranges.map(range => range.$to.pos))
const shouldShow = this.shouldShow({
const shouldShow = this.shouldShow?.({
editor: this.editor,
view,
state,