Skip to content

Interface: ImageDialog ​

Controller returned by createImageDialog().

Methods ​

apply() ​

ts
apply(): boolean;

Validate and apply. Returns false and sets error when something is missing or refused.

Returns ​

boolean


close() ​

ts
close(): void;

Close without applying and focus the editor. Does nothing while closed.

Returns ​

void


getAltHintProps() ​

ts
getAltHintProps(): ElementProps;

Props for the hint text the alt input's aria-describedby points to.

Returns ​

ElementProps


getAltInputProps() ​

ts
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 ​

ElementProps


getBackdropProps() ​

ts
getBackdropProps(): ElementProps;

An optional full-screen layer behind the panel; a press on it closes the dialog.

Returns ​

ElementProps


getCancelProps() ​

ts
getCancelProps(): ElementProps;

Props for the Cancel button, which closes the dialog.

Returns ​

ElementProps


getDecorativeProps() ​

ts
getDecorativeProps(): ElementProps;

Props for the "decorative image" checkbox.

Returns ​

ElementProps


getDialogProps() ​

ts
getDialogProps(): ElementProps;

The modal panel. Traps Tab inside and closes on Escape.

Returns ​

ElementProps


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: submit calls apply() instead of submitting the page.

Returns ​

ElementProps


getSrcInputProps() ​

ts
getSrcInputProps(): ElementProps;

Props for the address input: id, value, inputmode="url"; aria-invalid and aria-describedby on error.

Returns ​

ElementProps


getState() ​

ts
getState(): ImageDialogState;

The current state; the same object until something changes.

Returns ​

ImageDialogState


getTitleProps() ​

ts
getTitleProps(): ElementProps;

Props for the dialog title: the id the dialog's aria-labelledby points to.

Returns ​

ElementProps


getTriggerProps() ​

ts
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 ​

ElementProps


openDialog() ​

ts
openDialog(): void;

Open for the selected image (edit) or a new one (insert).

Returns ​

void


setAlt() ​

ts
setAlt(alt): void;

Set the alternative text field; clears an alt text error.

Parameters ​

ParameterType
altstring

Returns ​

void


setDecorative() ​

ts
setDecorative(decorative): void;

Mark the image as decorative (stored with alt=""); turning it on clears an alt text error.

Parameters ​

ParameterType
decorativeboolean

Returns ​

void


setSrc() ​

ts
setSrc(src): void;

Set the address field; clears an address error.

Parameters ​

ParameterType
srcstring

Returns ​

void


subscribe() ​

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

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

Parameters ​

ParameterType
listener() => void

Returns ​

() => void