Hi, we're experimenting with adopting the new version of Blockly that includes the new button for creating variables. However, I wanted to have the old mechanism for creating variables available too, where you could Create a Variable from the variable dropdown. I figured this would ease adoption for our course staff.
In core/field_variable.js, on line 191, inside Blockly.FieldVariable.prototype.onItemSelected, I added the following to the dispatcher:
} else if (this.newVarItemIndex_ >= 0 &&
menu.getChildAt(this.newVarItemIndex_) == menuItem) {
var set_value = this.set_value;
Blockly.Variables.createVariable(workspace, function(new_name) {
if (new_name !== null && new_name !== undefined) {
set_value(new_name);
}
});
return;
}
I figured something like this would work, and although it did create the variable, it didn't update auto-select that variable in the drop-down or even update the UI to include the new element. Instead, it just checked the menu item for Creating Variables. Any tips on how to have this functionality available again? I'm a little strapped for time before the semester starts, or I wouldn't bother you guys.

Happy new year,
~Cory