mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-28 22:10:31 -04:00
Don't allow shadow blocks to be deleted.
This commit is contained in:
parent
17ead475b9
commit
54ffdc5926
3 changed files with 3 additions and 3 deletions
|
@ -463,7 +463,7 @@ Blockly.Block.prototype.getDescendants = function() {
|
|||
* @return {boolean} True if deletable.
|
||||
*/
|
||||
Blockly.Block.prototype.isDeletable = function() {
|
||||
return this.deletable_ &&
|
||||
return this.deletable_ && !this.isShadow_ &&
|
||||
!(this.workspace && this.workspace.options.readOnly);
|
||||
};
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ Blockly.Xml.blockToDom_ = function(block) {
|
|||
if (block.disabled) {
|
||||
element.setAttribute('disabled', true);
|
||||
}
|
||||
if (!block.isDeletable()) {
|
||||
if (!block.isDeletable() && !block.isShadow()) {
|
||||
element.setAttribute('deletable', false);
|
||||
}
|
||||
if (!block.isMovable() && !block.isShadow()) {
|
||||
|
|
|
@ -146,7 +146,7 @@ Blockly.Dart['controls_forEach'] = function(block) {
|
|||
Blockly.Dart.ORDER_ASSIGNMENT) || '[]';
|
||||
var branch = Blockly.Dart.statementToCode(block, 'DO');
|
||||
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';
|
||||
return code;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue