mirror of
https://github.com/google/blockly.git
synced 2026-01-10 02:17:09 +01:00
Fix error by init of dropdown in case the value is "" (#2308)
I have following dropdown options
```
[
["no matter", ""]
["Update", "true"]
["Command", "false"]
]
```
In case my value is "" the text is not filled with "no matter" by the initial draw and the empty selector is shown. I expect the text "no matter"
This PR fixes that
This commit is contained in:
@@ -392,8 +392,8 @@ Blockly.FieldDropdown.prototype.getValue = function() {
|
||||
* @param {string} newValue New value to set.
|
||||
*/
|
||||
Blockly.FieldDropdown.prototype.setValue = function(newValue) {
|
||||
if (newValue === null || newValue === this.value_) {
|
||||
return; // No change if null.
|
||||
if (newValue === null || (newValue === this.value_ && this.text_)) {
|
||||
return; // No change if null and text_ was initialized.
|
||||
}
|
||||
if (this.sourceBlock_ && Blockly.Events.isEnabled()) {
|
||||
Blockly.Events.fire(new Blockly.Events.BlockChange(
|
||||
|
||||
Reference in New Issue
Block a user