From ed41b7f9003557c86452a4052176cb1921a41ffc Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Fri, 19 Jul 2019 09:17:09 -0700 Subject: [PATCH] Added a setOnClickHandler function to the image field. --- core/field_image.js | 10 ++++++++++ 1 file changed, 10 insertions(+) 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);