Skip to main content

Module: @lexical/react/LexicalContextMenuPlugin

Classes

Type Aliases

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

Type parameters

NameType
TOptionextends MenuOption

Type declaration

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

Parameters
NameType
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
Returns

ReactPortal | JSX.Element | null

Defined in

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


LexicalContextMenuPluginProps

Ƭ LexicalContextMenuPluginProps<TOption>: Object

Type parameters

NameType
TOptionextends MenuOption

Type declaration

NameType
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

Defined in

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

Type parameters

NameType
TOptionextends MenuOption

Type declaration

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

Parameters
NameType
anchorElementRefMutableRefObject<HTMLElement | null>
itemPropsObject
itemProps.optionsTOption[]
itemProps.selectOptionAndCleanUp(option: TOption) => void
itemProps.selectedIndexnumber | null
itemProps.setHighlightedIndex(index: number) => void
matchingStringstring | null
Returns

ReactPortal | JSX.Element | null

Defined in

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


Ƭ MenuResolution: Object

Type declaration

NameType
getRect() => DOMRect
match?MenuTextMatch

Defined in

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

Functions

LexicalContextMenuPlugin

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

Type parameters

NameType
TOptionextends MenuOption

Parameters

NameType
«destructured»LexicalContextMenuPluginProps<TOption>

Returns

JSX.Element | null

Defined in

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