Interface: LinkPopover
Controller returned by createLinkPopover().
Methods
apply()
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()
close(options?): void;Close without applying. Focuses the editor unless focusEditor is false.
Parameters
| Parameter | Type |
|---|---|
options? | { focusEditor?: boolean; } |
options.focusEditor? | boolean |
Returns
void
getErrorProps()
getErrorProps(): ElementProps;Props for the error message: role="alert", hidden while there is no error.
Returns
getFormProps()
getFormProps(): ElementProps;Props for the form: role="group", aria-label. Submit calls apply().
Returns
getInputProps()
getInputProps(): ElementProps;Props for the address input: aria-label, value, aria-invalid on error. Escape closes.
Returns
getRemoveProps()
getRemoveProps(): ElementProps;Props for the Remove button; hidden unless the selection is in a link.
Returns
getState()
getState(): LinkPopoverState;The current state; the same object until something changes.
Returns
getTriggerProps()
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
openPopover()
openPopover(): void;Open the form, filled with the current link's address or https://, and focus the field.
Returns
void
remove()
remove(): void;Remove the link at the selection and close.
Returns
void
setHref()
setHref(href): void;Set the address field; clears the error.
Parameters
| Parameter | Type |
|---|---|
href | string |
Returns
void
subscribe()
subscribe(listener): () => void;Call listener on every state change; returns the unsubscribe function.
Parameters
| Parameter | Type |
|---|---|
listener | () => void |
Returns
() => void