diff --git a/core/css.js b/core/css.js index 1fa075011..f0694a898 100644 --- a/core/css.js +++ b/core/css.js @@ -790,6 +790,14 @@ Blockly.Css.CONTENT = [ 'border: 1px solid #000 !important;', '}', + /* Remove the increase and decrease arrows on the field number editor */ + 'input.blocklyHtmlInput[type=number]::-webkit-inner-spin-button,', + 'input.blocklyHtmlInput[type=number]::-webkit-outer-spin-button {', + '-webkit-appearance: none;', + 'margin: 0;', + '}', + + /* Copied from: goog/css/menu.css */ /* * Copyright 2009 The Closure Library Authors. All Rights Reserved. diff --git a/core/field_number.js b/core/field_number.js index 2e729d193..88e62e763 100644 --- a/core/field_number.js +++ b/core/field_number.js @@ -99,6 +99,18 @@ Blockly.FieldNumber.prototype.setConstraints = function(min, max, precision) { this.setValue(this.getValue()); }; +/** + * Show the inline free-text editor on top of the text. + * @param {boolean=} opt_quietInput True if editor should be created without + * focus. Defaults to false. + * @protected + */ +Blockly.FieldNumber.prototype.showEditor_ = function(opt_quietInput) { + this.setSpellcheck(false); + Blockly.FieldNumber.superClass_.showEditor_.call(this, opt_quietInput); + this.htmlInput_.type = "number"; +}; + /** * Ensure that the input value is a valid number (must fulfill the * constraints placed on the field).