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 FieldImage class |
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| EDITABLE | readonly |
(not declared) | Editable fields usually show some sort of UI indicating they are editable. This field should not. |
| imageElement | protected |
SVGImageElement | null | The rendered field's image element. |
| imageHeight |
|
number | |
| isDirty_ | protected |
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 |
|---|---|---|
| configure_(config) | protected |
Configure the field based on the given map of options. |
| doClassValidation_(newValue) | protected |
Ensure that the input value (the source URL) is a string. |
| doValueUpdate_(newValue) | protected |
Update the value of this image field, and update the displayed image. |
| getFlipRtl() | Get whether to flip this image in RTL | |
| getText_() | protected |
Use the getText_ developer hook to override the field's text representation. Return the image alt text instead. |
| initView() | Create the block UI for this image. | |
| isClickable() | Check whether this field should be clickable. | |
| setAlt(alt) | Set the alt text of this image. | |
| setOnClickHandler(func) | Set the function that is called when this image is clicked. | |
| showEditor_() | protected |
If field click is called, and click handler defined, call the handler. |
| updateSize_() |