diff --git a/core/blockly.js b/core/blockly.js index 81c21fde422..e889cb84074 100644 --- a/core/blockly.js +++ b/core/blockly.js @@ -216,7 +216,12 @@ Blockly.deleteBlock = function(selected) { if (!selected.workspace.isFlyout) { Blockly.Events.setGroup(true); Blockly.hideChaff(); - selected.dispose(/* heal */ true, true); + if (selected.outputConnection) { + // Do not attempt to heal rows (https://github.com/google/blockly/issues/4832) + selected.dispose(false, true); + } else { + selected.dispose(/* heal */ true, true); + } Blockly.Events.setGroup(false); } }; diff --git a/core/contextmenu_items.js b/core/contextmenu_items.js index 63dbc702a15..b4adeb2f70e 100644 --- a/core/contextmenu_items.js +++ b/core/contextmenu_items.js @@ -479,7 +479,9 @@ Blockly.ContextMenuItems.registerDelete = function() { }, callback: function(/** @type {!Blockly.ContextMenuRegistry.Scope} */ scope) { Blockly.Events.setGroup(true); - scope.block.dispose(true, true); + if (scope.block) { + Blockly.deleteBlock(scope.block); + } Blockly.Events.setGroup(false); }, scopeType: Blockly.ContextMenuRegistry.ScopeType.BLOCK,