Merge pull request #894 from google/seanlip-block-descriptions

Use the empty field placeholder for dropdowns that do not have a value selected.
This commit is contained in:
Rachel Fenichel
2017-02-02 11:53:33 -08:00
committed by GitHub

View File

@@ -922,7 +922,11 @@ Blockly.Block.prototype.toString = function(opt_maxLength, opt_emptyToken) {
} else {
for (var i = 0, input; input = this.inputList[i]; i++) {
for (var j = 0, field; field = input.fieldRow[j]; j++) {
text.push(field.getText());
if (field instanceof Blockly.FieldDropdown && !field.getValue()) {
text.push(emptyFieldPlaceholder);
} else {
text.push(field.getText());
}
}
if (input.connection) {
var child = input.connection.targetBlock();