Interface: UseImageDialogResult
Returned by useImageDialog(): the controller state as fields, plus actions and prop getters.
Extends
Properties
| Property | Modifier | Type | Description | Inherited from |
|---|---|---|---|---|
alt | readonly | string | Current value of the alternative text field. | ImageDialogState.alt |
available | readonly | boolean | Whether the editor can hold images at all (has advancedSchema()). | ImageDialogState.available |
decorative | readonly | boolean | Decorative images get alt="" and are skipped by screen readers. | ImageDialogState.decorative |
error | readonly | string | null | Validation message, or null. | ImageDialogState.error |
errorField | readonly | "src" | "alt" | null | Which field the error belongs to. | ImageDialogState.errorField |
imageSelected | readonly | boolean | Whether an image is selected, so the trigger opens in "edit" mode. | ImageDialogState.imageSelected |
mode | readonly | "insert" | "edit" | "insert" adds a new image by address; "edit" changes the selected image. | ImageDialogState.mode |
open | readonly | boolean | The dialog is open. | ImageDialogState.open |
src | readonly | string | Current value of the address field. | ImageDialogState.src |
Methods
close()
close(): void;Close without applying and focus the editor. Does nothing while closed.
Returns
void
getAltHintProps()
getAltHintProps(): ReactProps;Props for the hint text the alt input's aria-describedby points to.
Returns
getAltInputProps()
getAltInputProps(): ReactProps;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(): ReactProps;An optional full-screen layer behind the panel; a press on it closes the dialog.
Returns
getCancelProps()
getCancelProps(): ReactProps;Props for the Cancel button, which closes the dialog.
Returns
getDecorativeProps()
getDecorativeProps(): ReactProps;Props for the "decorative image" checkbox.
Returns
getDialogProps()
getDialogProps(): ReactProps;The modal panel. Traps Tab inside and closes on Escape.
Returns
getErrorProps()
getErrorProps(): ReactProps;Props for the error message: role="alert", hidden while there is no error.
Returns
getFormProps()
getFormProps(): ReactProps;Props for the form: submit validates and applies instead of submitting the page.
Returns
getSrcInputProps()
getSrcInputProps(): ReactProps;Props for the address input: id, value, inputmode="url"; aria-invalid and aria-describedby on error.
Returns
getTitleProps()
getTitleProps(): ReactProps;Props for the dialog title: the id the dialog's aria-labelledby points to.
Returns
getTriggerProps()
getTriggerProps(): ReactProps;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