Commit 54ffdc59 authored by Neil Fraser's avatar Neil Fraser

Don't allow shadow blocks to be deleted.

parent 17ead475
...@@ -463,7 +463,7 @@ Blockly.Block.prototype.getDescendants = function() { ...@@ -463,7 +463,7 @@ Blockly.Block.prototype.getDescendants = function() {
* @return {boolean} True if deletable. * @return {boolean} True if deletable.
*/ */
Blockly.Block.prototype.isDeletable = function() { Blockly.Block.prototype.isDeletable = function() {
return this.deletable_ && return this.deletable_ && !this.isShadow_ &&
!(this.workspace && this.workspace.options.readOnly); !(this.workspace && this.workspace.options.readOnly);
}; };
......
...@@ -140,7 +140,7 @@ Blockly.Xml.blockToDom_ = function(block) { ...@@ -140,7 +140,7 @@ Blockly.Xml.blockToDom_ = function(block) {
if (block.disabled) { if (block.disabled) {
element.setAttribute('disabled', true); element.setAttribute('disabled', true);
} }
if (!block.isDeletable()) { if (!block.isDeletable() && !block.isShadow()) {
element.setAttribute('deletable', false); element.setAttribute('deletable', false);
} }
if (!block.isMovable() && !block.isShadow()) { if (!block.isMovable() && !block.isShadow()) {
......
...@@ -146,7 +146,7 @@ Blockly.Dart['controls_forEach'] = function(block) { ...@@ -146,7 +146,7 @@ Blockly.Dart['controls_forEach'] = function(block) {
Blockly.Dart.ORDER_ASSIGNMENT) || '[]'; Blockly.Dart.ORDER_ASSIGNMENT) || '[]';
var branch = Blockly.Dart.statementToCode(block, 'DO'); var branch = Blockly.Dart.statementToCode(block, 'DO');
branch = Blockly.Dart.addLoopTrap(branch, block.id); branch = Blockly.Dart.addLoopTrap(branch, block.id);
var code = 'for (var ' + variable0 + ' in ' + argument0 + ') {\n' + var code = 'for (var ' + variable0 + ' in ' + argument0 + ') {\n' +
branch + '}\n'; branch + '}\n';
return code; return code;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment