Add tabbing between text fields.

This commit is contained in:
Neil Fraser 2015-10-14 16:23:23 -07:00
parent c83faa3314
commit ded524ff3a
3 changed files with 49 additions and 3 deletions

View file

@ -170,12 +170,16 @@ Blockly.FieldTextInput.prototype.showEditor_ = function(opt_quietInput) {
*/
Blockly.FieldTextInput.prototype.onHtmlInputKeyDown_ = function(e) {
var htmlInput = Blockly.FieldTextInput.htmlInput_;
var enterKey = 13, escKey = 27;
var tabKey = 9, enterKey = 13, escKey = 27;
if (e.keyCode == enterKey) {
Blockly.WidgetDiv.hide();
} else if (e.keyCode == escKey) {
this.setText(htmlInput.defaultValue);
Blockly.WidgetDiv.hide();
} else if (e.keyCode == tabKey) {
Blockly.WidgetDiv.hide();
this.sourceBlock_.tab(this, !e.shiftKey);
e.preventDefault();
}
};