Add block name as JSON id.

This commit is contained in:
Neil Fraser
2015-06-11 18:06:44 -07:00
parent 9bfca8b019
commit 842783f442
3 changed files with 93 additions and 79 deletions

View File

@@ -258,10 +258,13 @@ Blockly.FieldTextInput.prototype.widgetDispose_ = function() {
// Save the edit (if it validates).
var text = htmlInput.value;
if (thisField.sourceBlock_ && thisField.changeHandler_) {
text = thisField.changeHandler_(text);
if (text === null) {
var text1 = thisField.changeHandler_(text);
if (text1 === null) {
// Invalid edit.
text = htmlInput.defaultValue;
} else if (text1 !== undefined) {
// Change handler has changed the text.
text = text1;
}
}
thisField.setText(text);