From 95fbc0bb49a717707b716c018f189a602964c790 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Mon, 14 Mar 2016 23:14:58 -0700 Subject: [PATCH] Fix checkbox events. Fix block deletion while mutator is open. --- core/block_svg.js | 2 +- core/field_checkbox.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/block_svg.js b/core/block_svg.js index 094615fce..8b6c36ed9 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -941,13 +941,13 @@ Blockly.BlockSvg.prototype.dispose = function(healStack, animate) { // Stop rerendering. this.rendered = false; - Blockly.BlockSvg.superClass_.dispose.call(this, healStack); Blockly.Events.disable(); var icons = this.getIcons(); for (var i = 0; i < icons.length; i++) { icons[i].dispose(); } Blockly.Events.enable(); + Blockly.BlockSvg.superClass_.dispose.call(this, healStack); goog.dom.removeNode(this.svgGroup_); // Sever JavaScript to DOM connections. diff --git a/core/field_checkbox.js b/core/field_checkbox.js index 7619c4e27..241336dc6 100644 --- a/core/field_checkbox.js +++ b/core/field_checkbox.js @@ -85,6 +85,10 @@ Blockly.FieldCheckbox.prototype.getValue = function() { Blockly.FieldCheckbox.prototype.setValue = function(strBool) { var newState = (strBool == 'TRUE'); if (this.state_ !== newState) { + if (this.sourceBlock_ && Blockly.Events.isEnabled()) { + Blockly.Events.fire(new Blockly.Events.Change( + this.sourceBlock_, 'field', this.name, this.state_, newState)); + } this.state_ = newState; if (this.checkElement_) { this.checkElement_.style.display = newState ? 'block' : 'none';