Skip to main content

@lexical/react/LexicalTypeaheadMenuPluginUtils

Variables​

getScrollParent​

const getScrollParent: (element, includeHidden) => HTMLElement | HTMLBodyElement = getScrollParent_

Defined in: packages/lexical-react/src/LexicalTypeaheadMenuPluginUtils.ts:35

Walks up from element and returns the nearest scrollable ancestor (or ownerDocument.body if none is found), used to keep the active typeahead option scrolled into view. Set includeHidden to also treat overflow: hidden ancestors as scroll parents.

The walk crosses ShadowRoot→host (via getParentElement) so a shadow-mounted editor's scroll parent is found in the enclosing light-DOM ancestor chain, and the styles / body are resolved through the element's own realm so an iframe-mounted editor stays inside its document.

Parameters​

element​

HTMLElement

includeHidden​

boolean

Returns​

HTMLElement | HTMLBodyElement

Deprecated​

Moved to @lexical/utils. Import getScrollParent from there.


PUNCTUATION​

const PUNCTUATION: "\.,\+\*\?\$\@\|#{}\(\)\^\-\[\]\\/!%'"=<>_:;" = '\.,\+\*\?\$\@\|#{}\(\)\^\-\[\]\\/!%'"=<>_:;'

Defined in: packages/lexical-react/src/LexicalTypeaheadMenuPluginUtils.ts:20

The default set of punctuation characters (as a character-class fragment) that terminate a typeahead query. Used as the default punctuation option of useBasicTypeaheadTriggerMatch.


SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND​

const SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND: LexicalCommand<{ index: number; option: MenuOption; }>

Defined in: packages/lexical-react/src/LexicalTypeaheadMenuPluginUtils.ts:29

Command dispatched while the typeahead menu is open to scroll the option at the given index into view. The built-in menu hook registers a default handler; custom implementations can register their own handler at a higher priority to override the scrolling behavior.

Functions​

useBasicTypeaheadTriggerMatch()​

useBasicTypeaheadTriggerMatch(trigger, __namedParameters): TriggerFn

Defined in: packages/lexical-react/src/LexicalTypeaheadMenuPluginUtils.ts:47

Builds a TriggerFn for the common case of a single-character trigger (such as @ or #) followed by a query. The returned function matches when the trigger is preceded by whitespace, an open parenthesis, or the start of the line and is followed by between minLength and maxLength non-punctuation characters (optionally allowing whitespace).

Parameters​

trigger​

string

__namedParameters​
allowWhitespace?​

boolean = false

maxLength?​

number = 75

minLength?​

number = 1

punctuation?​

string = PUNCTUATION

Returns​

TriggerFn

A memoized trigger function for LexicalTypeaheadMenuPlugin.