mirror of
https://github.com/google/blockly.git
synced 2026-01-10 10:27:08 +01:00
Fixed insertFieldAt (#2939)
* Fixed insertFieldAt. * Updated tests to reflect upcomming config changes.
This commit is contained in:
committed by
Sam El-Husseini
parent
b149aabd16
commit
e05e26ab45
@@ -106,8 +106,9 @@ Blockly.Input.prototype.insertFieldAt = function(index, field, opt_name) {
|
||||
throw Error('index ' + index + ' out of bounds.');
|
||||
}
|
||||
|
||||
// Empty string, Null or undefined generates no field, unless field is named.
|
||||
if (!field && !opt_name) {
|
||||
// Falsy field values don't generate a field, unless the field is an empty
|
||||
// string and named.
|
||||
if (!field && !(field == '' && opt_name)) {
|
||||
return index;
|
||||
}
|
||||
// Generate a FieldLabel when given a plain text field.
|
||||
|
||||
Reference in New Issue
Block a user