Interface: ImageDialog
Controller returned by createImageDialog().
Methods
apply()
apply(): boolean;Validate and apply. Returns false and sets error when something is missing or refused.
Returns
boolean
close()
close(): void;Close without applying and focus the editor. Does nothing while closed.
Returns
void
getAltHintProps()
getAltHintProps(): ElementProps;Props for the hint text the alt input's aria-describedby points to.
Returns
getAltInputProps()
getAltInputProps(): ElementProps;Props for the alternative text input: id, value, aria-required, aria-describedby (hint, and error when invalid). Disabled and empty while the image is marked decorative.
Returns
getBackdropProps()
getBackdropProps(): ElementProps;An optional full-screen layer behind the panel; a press on it closes the dialog.
Returns
getCancelProps()
getCancelProps(): ElementProps;Props for the Cancel button, which closes the dialog.
Returns
getDecorativeProps()
getDecorativeProps(): ElementProps;Props for the "decorative image" checkbox.
Returns
getDialogProps()
getDialogProps(): ElementProps;The modal panel. Traps Tab inside and closes on Escape.
Returns
getErrorProps()
getErrorProps(): ElementProps;Props for the error message: role="alert", hidden while there is no error.
Returns
getFormProps()
getFormProps(): ElementProps;Props for the form: submit calls apply() instead of submitting the page.
Returns
getSrcInputProps()
getSrcInputProps(): ElementProps;Props for the address input: id, value, inputmode="url"; aria-invalid and aria-describedby on error.
Returns
getState()
getState(): ImageDialogState;The current state; the same object until something changes.
Returns
getTitleProps()
getTitleProps(): ElementProps;Props for the dialog title: the id the dialog's aria-labelledby points to.
Returns
getTriggerProps()
getTriggerProps(): ElementProps;Props for the toolbar button: aria-label (add or edit image), aria-haspopup, aria-expanded, data-state; disabled without image support. Click opens the dialog; mousedown is prevented to keep the selection.
Returns
openDialog()
openDialog(): void;Open for the selected image (edit) or a new one (insert).
Returns
void
setAlt()
setAlt(alt): void;Set the alternative text field; clears an alt text error.
Parameters
| Parameter | Type |
|---|---|
alt | string |
Returns
void
setDecorative()
setDecorative(decorative): void;Mark the image as decorative (stored with alt=""); turning it on clears an alt text error.
Parameters
| Parameter | Type |
|---|---|
decorative | boolean |
Returns
void
setSrc()
setSrc(src): void;Set the address field; clears an address error.
Parameters
| Parameter | Type |
|---|---|
src | string |
Returns
void
subscribe()
subscribe(listener): () => void;Call listener on every state change; returns the unsubscribe function.
Parameters
| Parameter | Type |
|---|---|
listener | () => void |
Returns
() => void