mirror of
https://github.com/google/blockly.git
synced 2026-01-08 17:40:09 +01:00
Fix input resizing during text entry
This commit is contained in:
@@ -173,11 +173,13 @@ Blockly.FieldTextInput.prototype.onHtmlInputKeyDown_ = function(e) {
|
|||||||
var htmlInput = Blockly.FieldTextInput.htmlInput_;
|
var htmlInput = Blockly.FieldTextInput.htmlInput_;
|
||||||
var tabKey = 9, enterKey = 13, escKey = 27;
|
var tabKey = 9, enterKey = 13, escKey = 27;
|
||||||
if (e.keyCode == enterKey) {
|
if (e.keyCode == enterKey) {
|
||||||
|
this.setValue(this.getText());
|
||||||
Blockly.WidgetDiv.hide();
|
Blockly.WidgetDiv.hide();
|
||||||
} else if (e.keyCode == escKey) {
|
} else if (e.keyCode == escKey) {
|
||||||
htmlInput.value = htmlInput.defaultValue;
|
htmlInput.value = htmlInput.defaultValue;
|
||||||
Blockly.WidgetDiv.hide();
|
Blockly.WidgetDiv.hide();
|
||||||
} else if (e.keyCode == tabKey) {
|
} else if (e.keyCode == tabKey) {
|
||||||
|
this.setValue(this.getText());
|
||||||
Blockly.WidgetDiv.hide();
|
Blockly.WidgetDiv.hide();
|
||||||
this.sourceBlock_.tab(this, !e.shiftKey);
|
this.sourceBlock_.tab(this, !e.shiftKey);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -195,6 +197,7 @@ Blockly.FieldTextInput.prototype.onHtmlInputChange_ = function(e) {
|
|||||||
var text = htmlInput.value;
|
var text = htmlInput.value;
|
||||||
if (text !== htmlInput.oldValue_) {
|
if (text !== htmlInput.oldValue_) {
|
||||||
htmlInput.oldValue_ = text;
|
htmlInput.oldValue_ = text;
|
||||||
|
this.setText(text);
|
||||||
this.validate_();
|
this.validate_();
|
||||||
} else if (goog.userAgent.WEBKIT) {
|
} else if (goog.userAgent.WEBKIT) {
|
||||||
// Cursor key. Render the source block to show the caret moving.
|
// Cursor key. Render the source block to show the caret moving.
|
||||||
|
|||||||
Reference in New Issue
Block a user