Skip to content

Interface: LinkPopover ​

Controller returned by createLinkPopover().

Methods ​

apply() ​

ts
apply(): boolean;

Apply the address with setLink() and close. An empty address removes the link. Returns false and sets error when the address is refused.

Returns ​

boolean


close() ​

ts
close(options?): void;

Close without applying. Focuses the editor unless focusEditor is false.

Parameters ​

ParameterType
options?{ focusEditor?: boolean; }
options.focusEditor?boolean

Returns ​

void


getErrorProps() ​

ts
getErrorProps(): ElementProps;

Props for the error message: role="alert", hidden while there is no error.

Returns ​

ElementProps


getFormProps() ​

ts
getFormProps(): ElementProps;

Props for the form: role="group", aria-label. Submit calls apply().

Returns ​

ElementProps


getInputProps() ​

ts
getInputProps(): ElementProps;

Props for the address input: aria-label, value, aria-invalid on error. Escape closes.

Returns ​

ElementProps


getRemoveProps() ​

ts
getRemoveProps(): ElementProps;

Props for the Remove button; hidden unless the selection is in a link.

Returns ​

ElementProps


getState() ​

ts
getState(): LinkPopoverState;

The current state; the same object until something changes.

Returns ​

LinkPopoverState


getTriggerProps() ​

ts
getTriggerProps(): ElementProps;

Props for the toolbar button: id, aria-label, title with the shortcut, aria-keyshortcuts, aria-pressed (inside a link), aria-expanded, aria-controls. Click toggles the form.

Returns ​

ElementProps


openPopover() ​

ts
openPopover(): void;

Open the form, filled with the current link's address or https://, and focus the field.

Returns ​

void


remove() ​

ts
remove(): void;

Remove the link at the selection and close.

Returns ​

void


setHref() ​

ts
setHref(href): void;

Set the address field; clears the error.

Parameters ​

ParameterType
hrefstring

Returns ​

void


subscribe() ​

ts
subscribe(listener): () => void;

Call listener on every state change; returns the unsubscribe function.

Parameters ​

ParameterType
listener() => void

Returns ​

() => void