跳至主要内容

模組:@lexical/react/LexicalContextMenuPlugin

類別

類型別名

ContextMenuRenderFn

Ƭ ContextMenuRenderFn<TOption>: (anchorElementRef: MutableRefObject<HTMLElement | null>, itemProps: { options: TOption[] ; selectOptionAndCleanUp: (option: TOption) => void ; selectedIndex: number | null ; setHighlightedIndex: (index: number) => void }, menuProps: { setMenuRef: (element: HTMLElement | null) => void }) => ReactPortal | JSX.Element | null

類型參數

名稱類型
TOption擴展自 MenuOption

類型宣告

▸ (anchorElementRef, itemProps, menuProps): ReactPortal | JSX.Element | null

參數
名稱類型
anchorElementRefMutableRefObject<HTMLElement | null>
itemPropsObject
itemProps.optionsTOption[]
itemProps.selectOptionAndCleanUp(option: TOption) => void
itemProps.selectedIndexnumber | null
itemProps.setHighlightedIndex(index: number) => void
menuPropsObject
menuProps.setMenuRef(element: HTMLElement | null) => void
回傳

ReactPortal | JSX.Element | null

定義於

packages/lexical-react/src/LexicalContextMenuPlugin.tsx:28


LexicalContextMenuPluginProps

Ƭ LexicalContextMenuPluginProps<TOption>: Object

類型參數

名稱類型
TOption擴展自 MenuOption

類型宣告

名稱類型
anchorClassName?string
commandPriority?CommandListenerPriority
menuRenderFnContextMenuRenderFn<TOption>
onClose?() => void
onOpen?(resolution: MenuResolution) => void
onSelectOption(option: TOption, textNodeContainingQuery: LexicalNode | null, closeMenu: () => void, matchingString: string) => void
onWillOpen?(event: MouseEvent) => void
optionsTOption[]
parent?HTMLElement

定義於

packages/lexical-react/src/LexicalContextMenuPlugin.tsx:41


Ƭ MenuRenderFn<TOption>: (anchorElementRef: MutableRefObject<HTMLElement | null>, itemProps: { options: TOption[] ; selectOptionAndCleanUp: (option: TOption) => void ; selectedIndex: number | null ; setHighlightedIndex: (index: number) => void }, matchingString: string | null) => ReactPortal | JSX.Element | null

類型參數

名稱類型
TOption擴展自 MenuOption

類型宣告

▸ (anchorElementRef, itemProps, matchingString): ReactPortal | JSX.Element | null

參數
名稱類型
anchorElementRefMutableRefObject<HTMLElement | null>
itemPropsObject
itemProps.optionsTOption[]
itemProps.selectOptionAndCleanUp(option: TOption) => void
itemProps.selectedIndexnumber | null
itemProps.setHighlightedIndex(index: number) => void
matchingStringstring | null
回傳

ReactPortal | JSX.Element | null

定義於

packages/lexical-react/src/shared/LexicalMenu.ts:66


Ƭ MenuResolution: Object

類型宣告

名稱類型
getRect() => DOMRect
match?MenuTextMatch

定義於

packages/lexical-react/src/shared/LexicalMenu.ts:43

函式

LexicalContextMenuPlugin

LexicalContextMenuPlugin<TOption>(«destructured»): JSX.Element | null

類型參數

名稱類型
TOption擴展自 MenuOption

參數

名稱類型
«destructured»LexicalContextMenuPluginProps<TOption>

回傳

JSX.Element | null

定義於

packages/lexical-react/src/LexicalContextMenuPlugin.tsx:60