Don't insert disabled blocks from the flyout. (#3046)

* Don't insert disabled blocks from the flyout.
This commit is contained in:
Sam El-Husseini
2019-09-18 16:42:25 -07:00
committed by GitHub
parent a8a8c320d5
commit 22cf08d16c

View File

@@ -302,8 +302,13 @@ Blockly.navigation.insertFromFlyout = function() {
return;
}
var newBlock = flyout.createBlock(
Blockly.navigation.getFlyoutCursor_().getCurNode().getLocation());
var curBlock = Blockly.navigation.getFlyoutCursor_().getCurNode().getLocation();
if (!curBlock.isEnabled()) {
Blockly.navigation.warn_('Can\'t insert a disabled block.');
return;
}
var newBlock = flyout.createBlock(curBlock);
// Render to get the sizing right.
newBlock.render();
// Connections are hidden when the block is first created. Normally there's