Stay organized with collections Save and categorize content based on your preferences.

blockly > FieldImage

FieldImage class

Class for an image on a block.

Signature:

export declare class FieldImage extends Field 

Extends: Field

Constructors

Constructor Modifiers Description
(constructor)(src, width, height, opt_alt, opt_onClick, opt_flipRtl, opt_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.
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.
size_ protected Size
value_ any

Methods

Method Modifiers Description
configure_(config) protected Configure the field based on the given map of options.
doClassValidation_(opt_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.
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_()