Hi
If you don't want to use that reference in your project , You can extent the existing fieldimage in your blockly you may get it under the following folder ( blockly\core\FieldImage)
change the code in appropriate place and link the file externally how to link the script file to html page specify the link at last .
Blockly.FieldImage = function(src, width, height, opt_alt,clickEvent) {
this.sourceBlock_ = null;
// Ensure height and width are numbers. Strings are bad at math.
this.height_ = Number(height);
this.width_ = Number(width);
this.size_ = new goog.math.Size(this.width_,
this.height_ + 2 * Blockly.BlockSvg.INLINE_PADDING_Y);
this.text_ = opt_alt || '';
this.setValue(src);
this.clickEvent = clickEvent;
};
under
Blockly.FieldImage.prototype.init = function(block) {
// at last link give this code
// assigning the clickevent handler
this.clickEventListener(this.imageElement_,this.clickEvent);
}
//definition for click listener
Blockly.FieldImage.prototype.clickEventListener = function(imageElement, functionName){
if(functionName){
imageElement.addEventListener("click", functionName);
}
};