diff --git a/core/field_image.js b/core/field_image.js index bd5a56ae1..a0959125e 100644 --- a/core/field_image.js +++ b/core/field_image.js @@ -189,4 +189,14 @@ Blockly.FieldImage.prototype.showEditor_ = function() { } }; +/** + * Set the function that is called when this image is clicked. + * @param {function} func The function that is called when the image + * is clicked. It will receive the image field as a parameter. + * @public + */ +Blockly.FieldImage.prototype.setOnClickHandler = function(func) { + this.clickHandler_ = func; +}; + Blockly.Field.register('field_image', Blockly.FieldImage);