mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-20 18:09:43 -04:00
Fix #326
Parameter block is removed from init prototype of fields and its usage is replaced by this.sourceBlock_
This commit is contained in:
parent
78b4514f15
commit
1e3297ba0a
4 changed files with 12 additions and 14 deletions
|
@ -79,18 +79,19 @@ Blockly.FieldVariable.prototype.setValidator = function(handler) {
|
|||
|
||||
/**
|
||||
* Install this dropdown on a block.
|
||||
* @param {!Blockly.Block} block The block containing this text.
|
||||
*/
|
||||
Blockly.FieldVariable.prototype.init = function(block) {
|
||||
Blockly.FieldVariable.prototype.init = function() {
|
||||
if (this.fieldGroup_) {
|
||||
// Dropdown has already been initialized once.
|
||||
return;
|
||||
}
|
||||
Blockly.FieldVariable.superClass_.init.call(this, block);
|
||||
Blockly.FieldVariable.superClass_.init.call(this);
|
||||
if (!this.getValue()) {
|
||||
// Variables without names get uniquely named for this workspace.
|
||||
var workspace =
|
||||
block.isInFlyout ? block.workspace.targetWorkspace : block.workspace;
|
||||
this.sourceBlock_.isInFlyout ?
|
||||
this.sourceBlock_.workspace.targetWorkspace :
|
||||
this.sourceBlock_.workspace;
|
||||
this.setValue(Blockly.Variables.generateUniqueName(workspace));
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue