From 217206911a92f7a0c657cd55d7cef309a271922f Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Fri, 7 Jun 2019 07:03:43 -0700 Subject: [PATCH] Fixed some formatting in text input. --- core/field_textinput.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/field_textinput.js b/core/field_textinput.js index 87a43b75a..20636c8e8 100644 --- a/core/field_textinput.js +++ b/core/field_textinput.js @@ -230,8 +230,6 @@ Blockly.FieldTextInput.prototype.showInlineEditor_ = function(quietInput) { this.htmlInput_.focus(); this.htmlInput_.select(); } - - this.bindInputEvents_(); }; Blockly.FieldTextInput.prototype.widgetCreate_ = function() { @@ -257,22 +255,24 @@ Blockly.FieldTextInput.prototype.widgetCreate_ = function() { }; /** - * Bind handlers for user input on the text input field's editor.. + * Bind handlers for user input on the text input field's editor. + * @param {!HTMLInputElement} htmlInput The htmlInput to which event + * handlers will be bound. * @private */ -Blockly.FieldTextInput.prototype.bindInputEvents_ = function() { +Blockly.FieldTextInput.prototype.bindInputEvents_ = function(htmlInput) { // Trap Enter without IME and Esc to hide. this.onKeyDownWrapper_ = Blockly.bindEventWithChecks_( - this.htmlInput_, 'keydown', this, this.onHtmlInputKeyDown_); + htmlInput, 'keydown', this, this.onHtmlInputKeyDown_); // Resize after every keystroke. this.onKeyUpWrapper_ = Blockly.bindEventWithChecks_( - this.htmlInput_, 'keyup', this, this.onHtmlInputChange_); + htmlInput, 'keyup', this, this.onHtmlInputChange_); // Repeatedly resize when holding down a key. this.onKeyPressWrapper_ = Blockly.bindEventWithChecks_( - this.htmlInput_, 'keypress', this, this.onHtmlInputChange_); + htmlInput, 'keypress', this, this.onHtmlInputChange_); // TODO: Figure out if this is necessary. this.onWorkspaceChangeWrapper_ = this.resizeEditor_.bind(this);