Skip to content

OverlayHandler

Defined in: react/markput/src/lib/hooks/useOverlay.tsx:7

Type Parameter Default type
TElement extends HTMLElement HTMLElement
activate: () => () => void;

Defined in: react/markput/src/lib/hooks/useOverlay.tsx:29

Bind the list’s keyboard protocol — arrows move the highlight, Enter chooses — to the editing host, and return the unbind. OPT-IN, because an overlay that is not a list must not swallow those keys: the built-in component calls it on mount, and a custom one calls it to get the same contract.

(): void;

void


active: number;

Defined in: react/markput/src/lib/hooks/useOverlay.tsx:22

Index into OverlayHandler.rows of the highlighted row; NaN when none is.


choose: (pick) => boolean;

Defined in: react/markput/src/lib/hooks/useOverlay.tsx:35

The one accept path. {option} turns the caret’s row into that option’s row kind and removes the trigger in the same splice; {value, meta} writes the trigger option’s markup, which is what select does.

Parameter Type
pick OverlayPick

boolean


close: () => void;

Defined in: react/markput/src/lib/hooks/useOverlay.tsx:12

void


match:
| OverlayMatch<Option<MarkProps, OverlayProps>>
| undefined;

Defined in: react/markput/src/lib/hooks/useOverlay.tsx:36


ref: RefObject<TElement | null>;

Defined in: react/markput/src/lib/hooks/useOverlay.tsx:47

THE OVERLAY’S OWN ELEMENT, handed back so core can measure the popup and flip it above the caret when it does not fit below. A consumer attaches it to whatever element it paints.

IT IS THE ELEMENT’S TYPE, not HTMLElement, and that is what the parameter is for. React’s ref prop is invariant — {current: HTMLElement | null} is not a Ref<HTMLDivElement> — so a handler that could only ever answer the base type made every consumer of a concrete element write an assertion or a callback ref around it. useOverlay<HTMLDivElement>() is the same object with the type the consumer already knows.


rows: readonly OverlayRow[];

Defined in: react/markput/src/lib/hooks/useOverlay.tsx:20

THE LIST the open overlay offers, already narrowed by what was typed after the trigger: the matched option’s overlay.data when it declares any, and the ROW MENU — every option carrying a menu — when it declares none. An overlay component filters nothing and knows neither source; it paints label and hands pick back to OverlayHandler.choose.


select: (value) => void;

Defined in: react/markput/src/lib/hooks/useOverlay.tsx:13

Parameter Type
value { meta?: string; value: string; }
value.meta? string
value.value string

void


style: object;

Defined in: react/markput/src/lib/hooks/useOverlay.tsx:8

left: number;
top: number;