mirror of
https://github.com/google/blockly.git
synced 2026-01-08 17:40:09 +01:00
Disable break/return blocks in addition to warning.
This commit is contained in:
@@ -843,6 +843,9 @@ Blockly.Blocks['procedures_ifreturn'] = {
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
onchange: function(e) {
|
||||
if (this.workspace.isDragging()) {
|
||||
return; // Don't change state at the start of a drag.
|
||||
}
|
||||
var legal = false;
|
||||
// Is the block nested in a procedure?
|
||||
var block = this;
|
||||
@@ -868,8 +871,14 @@ Blockly.Blocks['procedures_ifreturn'] = {
|
||||
this.hasReturnValue_ = true;
|
||||
}
|
||||
this.setWarningText(null);
|
||||
if (!this.isInFlyout) {
|
||||
this.setDisabled(false);
|
||||
}
|
||||
} else {
|
||||
this.setWarningText(Blockly.Msg.PROCEDURES_IFRETURN_WARNING);
|
||||
if (!this.isInFlyout && !this.getInheritedDisabled()) {
|
||||
this.setDisabled(true);
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user