mirror of
https://github.com/google/blockly.git
synced 2026-03-10 07:10:11 +01:00
Destroy attached shadow block when input is destroyed.
This commit is contained in:
@@ -1232,8 +1232,15 @@ Blockly.Block.prototype.removeInput = function(name, opt_quiet) {
|
||||
for (var i = 0, input; input = this.inputList[i]; i++) {
|
||||
if (input.name == name) {
|
||||
if (input.connection && input.connection.targetConnection) {
|
||||
// Disconnect any attached block.
|
||||
input.connection.targetBlock().unplug();
|
||||
input.connection.setShadowDom(null);
|
||||
var block = input.connection.targetBlock();
|
||||
if (block.isShadow()) {
|
||||
// Destroy any attached shadow block.
|
||||
block.dispose();
|
||||
} else {
|
||||
// Disconnect any attached normal block.
|
||||
block.unplug();
|
||||
}
|
||||
}
|
||||
input.dispose();
|
||||
this.inputList.splice(i, 1);
|
||||
|
||||
@@ -499,7 +499,7 @@ Blockly.BlockSvg.prototype.onMouseDown_ = function(e) {
|
||||
// Right-click.
|
||||
this.showContextMenu_(e);
|
||||
} else if (!this.isMovable()) {
|
||||
// Allow unmovable blocks to be selected and context menued, but not
|
||||
// Allow immovable blocks to be selected and context menued, but not
|
||||
// dragged. Let this event bubble up to document, so the workspace may be
|
||||
// dragged instead.
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user