Disable/enable function calls along with their definitions (#2019)

Fixes #1344

Extends the event listener on procedure caller blocks to also check
for their definition being enabled/disabled and update their own
state in response.
This commit is contained in:
RoboErikG
2018-08-23 11:18:29 -07:00
committed by GitHub
parent 57aa2e966b
commit 9eacd7d3b9
4 changed files with 410 additions and 0 deletions

View File

@@ -669,7 +669,14 @@ Blockly.BlockSvg.prototype.showContextMenu_ = function(e) {
Blockly.Msg['ENABLE_BLOCK'] : Blockly.Msg['DISABLE_BLOCK'],
enabled: !this.getInheritedDisabled(),
callback: function() {
var group = Blockly.Events.getGroup();
if (!group) {
Blockly.Events.setGroup(true);
}
block.setDisabled(!block.disabled);
if (!group) {
Blockly.Events.setGroup(false);
}
}
};
menuOptions.push(disableOption);