diff --git a/core/css.js b/core/css.js index 775f9d4f1..10013b1f8 100644 --- a/core/css.js +++ b/core/css.js @@ -537,8 +537,9 @@ Blockly.Css.CONTENT = [ 'height: 100%;', 'margin: 0;', 'outline: none;', - 'padding: 0 1px;', - 'width: 100%', + 'padding: 0;', + 'width: 100%;', + 'text-align: center;', '}', '.blocklyMainBackground {', diff --git a/core/field_textinput.js b/core/field_textinput.js index 923807ea1..1f5a80f3c 100644 --- a/core/field_textinput.js +++ b/core/field_textinput.js @@ -301,14 +301,10 @@ Blockly.FieldTextInput.prototype.bindInputEvents_ = function(htmlInput) { this.onKeyDownWrapper_ = Blockly.bindEventWithChecks_( htmlInput, 'keydown', this, this.onHtmlInputKeyDown_); - // Resize after every keystroke. - this.onKeyUpWrapper_ = + // Resize after every input change. + this.onKeyInputWrapper_ = Blockly.bindEventWithChecks_( - htmlInput, 'keyup', this, this.onHtmlInputChange_); - // Repeatedly resize when holding down a key. - this.onKeyPressWrapper_ = - Blockly.bindEventWithChecks_( - htmlInput, 'keypress', this, this.onHtmlInputChange_); + htmlInput, 'input', this, this.onHtmlInputChange_); }; /** @@ -317,8 +313,7 @@ Blockly.FieldTextInput.prototype.bindInputEvents_ = function(htmlInput) { */ Blockly.FieldTextInput.prototype.unbindInputEvents_ = function() { Blockly.unbindEvent_(this.onKeyDownWrapper_); - Blockly.unbindEvent_(this.onKeyUpWrapper_); - Blockly.unbindEvent_(this.onKeyPressWrapper_); + Blockly.unbindEvent_(this.onKeyInputWrapper_); }; /**