FieldImage class
Class for an image on a block.
Signature:
export declare class FieldImage extends Field<string>
Extends: Field<string>
Constructors
Constructor | Modifiers | Description |
|---|---|---|
(constructor)(src, width, height, alt, onClick, flipRtl, config) | Constructs a new instance of the |
Properties
Property | Modifiers | Type | Description |
|---|---|---|---|
| (not declared) | Editable fields usually show some sort of UI indicating they are editable. This field should not. | |
| SVGImageElement | null | The rendered field's image element. | |
| number | ||
| boolean | Used to tell if the field needs to be rendered the next time the block is rendered. Image fields are statically sized, and only need to be rendered at initialization. |
Methods
Method | Modifiers | Description |
|---|---|---|
Computes a descriptive ARIA label to represent this field with configurable verbosity. A 'verbose' label includes type information, if available, whereas a non-verbose label only contains the field's value. Note that this will always return the latest representation of the field's label which may differ from any previously set ARIA label for the field itself. Implementations are largely responsible for ensuring that the field's ARIA label is set correctly at relevant moments in the field's lifecycle (such as when its value changes). Finally, it is never guaranteed that implementations use the label returned by this method for their actual ARIA label. Some implementations may rely on other contexts to convey information like the field's value. Example: checkboxes represent their checked/non-checked status (i.e. value) through a separate ARIA property. Returns an empty string on clickable images (buttons), as we do not want to include image buttons on the block-level ARIA label. When the button is focused the label is set in recomputeAriaContext below. | ||
| Configure the field based on the given map of options. | |
| Ensure that the input value (the source URL) is a string. | |
| Update the value of this image field, and update the displayed image. | |
Gets an ARIA-friendly label representation of this field's type. Implementations are responsible for, and encouraged to, return a localized version of the ARIA representation of the field's type. | ||
Gets an ARIA-friendly label representation of this field's value. Implementations are responsible for, and encouraged to, return a localized version of the ARIA representation of the field's value. | ||
Get whether to flip this image in RTL | ||
| Use the | |
Create the block UI for this image. | ||
Check whether this field should be clickable. | ||
Customizes label and sets additional aria state. | ||
Set the alt text of this image. | ||
Set the function that is called when this image is clicked. | ||
| If field click is called, and click handler defined, call the handler. | |