Skip to content

Commit

Permalink
fix: resolve error when adding the stop block to the workspace (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
gonfunko authored May 6, 2024
1 parent 70c8cfd commit f3e059c
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions blocks_vertical/control.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,8 @@ Blockly.Blocks['control_stop'] = {
[Blockly.Msg.CONTROL_STOP_OTHER, OTHER_SCRIPTS]
];
}, function(option) {
// Create an event group to keep field value and mutator in sync
// Return null at the end because setValue is called here already.
Blockly.Events.setGroup(true);
var oldMutation = Blockly.Xml.domToText(this.sourceBlock_.mutationToDom());
this.sourceBlock_.setNextStatement(option == OTHER_SCRIPTS);
var newMutation = Blockly.Xml.domToText(this.sourceBlock_.mutationToDom());
Blockly.Events.fire(new Blockly.Events.BlockChange(this.sourceBlock_,
'mutation', null, oldMutation, newMutation));
this.setValue(option);
Blockly.Events.setGroup(false);
return null;
this.getSourceBlock().setNextStatement(option === OTHER_SCRIPTS);
return option;
});
this.appendDummyInput()
.appendField(Blockly.Msg.CONTROL_STOP)
Expand All @@ -209,15 +200,6 @@ Blockly.Blocks['control_stop'] = {
Colours.control.quaternary
);
this.setPreviousStatement(true);
},
mutationToDom: function() {
var container = document.createElement('mutation');
container.setAttribute('hasnext', this.nextConnection != null);
return container;
},
domToMutation: function(xmlElement) {
var hasNext = (xmlElement.getAttribute('hasnext') == 'true');
this.setNextStatement(hasNext);
}
};

Expand Down

0 comments on commit f3e059c

Please sign in to comment.