Blockly.utils.userAgent moved to Blockly.userAgent

This commit is contained in:
Neil Fraser
2019-05-10 16:56:26 -07:00
parent 25ddecab50
commit 28ad3a9bd3
19 changed files with 138 additions and 91 deletions

View File

@@ -29,6 +29,7 @@ goog.provide('Blockly.FieldTextInput');
goog.require('Blockly.DropDownDiv');
goog.require('Blockly.Field');
goog.require('Blockly.Msg');
goog.require('Blockly.userAgent');
goog.require('Blockly.utils');
goog.require('goog.math.Coordinate');
@@ -165,9 +166,9 @@ Blockly.FieldTextInput.prototype.setSpellcheck = function(check) {
Blockly.FieldTextInput.prototype.showEditor_ = function(opt_quietInput) {
this.workspace_ = this.sourceBlock_.workspace;
var quietInput = opt_quietInput || false;
if (!quietInput && (Blockly.utils.userAgent.MOBILE ||
Blockly.utils.userAgent.ANDROID ||
Blockly.utils.userAgent.IPAD)) {
if (!quietInput && (Blockly.userAgent.MOBILE ||
Blockly.userAgent.ANDROID ||
Blockly.userAgent.IPAD)) {
this.showPromptEditor_();
} else {
this.showInlineEditor_(quietInput);
@@ -301,7 +302,7 @@ Blockly.FieldTextInput.prototype.onHtmlInputChange_ = function(_e) {
this.setValue(text);
Blockly.Events.setGroup(false);
this.validate_();
} else if (Blockly.utils.userAgent.WEBKIT) {
} else if (Blockly.userAgent.WEBKIT) {
// Cursor key. Render the source block to show the caret moving.
// Chrome only (version 26, OS X).
this.sourceBlock_.render();
@@ -348,13 +349,13 @@ Blockly.FieldTextInput.prototype.resizeEditor_ = function() {
// Shift by a few pixels to line up exactly.
xy.y += 1;
if (Blockly.utils.userAgent.GECKO && Blockly.WidgetDiv.DIV.style.top) {
if (Blockly.userAgent.GECKO && Blockly.WidgetDiv.DIV.style.top) {
// Firefox mis-reports the location of the border by a pixel
// once the WidgetDiv is moved into position.
xy.x -= 1;
xy.y -= 1;
}
if (Blockly.utils.userAgent.WEBKIT) {
if (Blockly.userAgent.WEBKIT) {
xy.y -= 3;
}
div.style.left = xy.x + 'px';