OverlayHandler
Defined in: react/markput/src/lib/hooks/useOverlay.tsx:7
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
TElement extends HTMLElement |
HTMLElement |
Properties
Section titled “Properties”activate()
Section titled “activate()”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.
Returns
Section titled “Returns”(): void;Returns
Section titled “Returns”void
active
Section titled “active”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()
Section titled “choose()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
pick |
OverlayPick |
Returns
Section titled “Returns”boolean
close()
Section titled “close()”close: () => void;Defined in: react/markput/src/lib/hooks/useOverlay.tsx:12
Returns
Section titled “Returns”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()
Section titled “select()”select: (value) => void;Defined in: react/markput/src/lib/hooks/useOverlay.tsx:13
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value |
{ meta?: string; value: string; } |
value.meta? |
string |
value.value |
string |
Returns
Section titled “Returns”void
style: object;Defined in: react/markput/src/lib/hooks/useOverlay.tsx:8
left: number;top: number;