Commit 842783f4 authored by Neil Fraser's avatar Neil Fraser

Add block name as JSON id.

parent 9bfca8b0
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -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);
......
......@@ -82,6 +82,8 @@ function updateLanguage() {
*/
function formatJson(code, rootBlock) {
var JS = {};
// ID is not used by Blockly, but may be used by a loader.
JS.id = blockType;
// Generate inputs.
var message = [];
var args = [];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment