diff --git a/core/block_svg.js b/core/block_svg.js index efcacab5c..e5d191b1a 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -127,6 +127,11 @@ Blockly.BlockSvg.prototype.initSvg = function() { * Select this block. Highlight it visually. */ Blockly.BlockSvg.prototype.select = function() { + if (this.isShadow() && this.getParent()) { + // Shadow blocks should not be selected. + this.getParent().select(); + return; + } if (Blockly.selected == this) { return; } @@ -563,7 +568,8 @@ Blockly.BlockSvg.prototype.onMouseDown_ = function(e) { * @private */ Blockly.BlockSvg.prototype.onMouseUp_ = function(e) { - if (Blockly.dragMode_ != Blockly.DRAG_FREE) { + if (Blockly.dragMode_ != Blockly.DRAG_FREE && + !Blockly.WidgetDiv.isVisible()) { Blockly.Events.fire( new Blockly.Events.Ui(this, 'click', undefined, undefined)); } diff --git a/core/blockly.js b/core/blockly.js index 365255099..aee1a20ca 100644 --- a/core/blockly.js +++ b/core/blockly.js @@ -233,15 +233,12 @@ Blockly.onKeyDown_ = function(e) { Blockly.hideChaff(); } else if (e.keyCode == 8 || e.keyCode == 46) { // Delete or backspace. - try { - if (Blockly.selected && Blockly.selected.isDeletable()) { - deleteBlock = true; - } - } finally { - // Stop the browser from going back to the previous page. - // Use a finally so that any error in delete code above doesn't disappear - // from the console when the page rolls back. - e.preventDefault(); + // Stop the browser from going back to the previous page. + // Do this first to prevent an error in the delete code from resulting in + // data loss. + e.preventDefault(); + if (Blockly.selected && Blockly.selected.isDeletable()) { + deleteBlock = true; } } else if (e.altKey || e.ctrlKey || e.metaKey) { if (Blockly.selected &&