mirror of
https://github.com/google/blockly.git
synced 2026-01-07 09:00:11 +01:00
Remove deprecated field functions (#4489)
This commit is contained in:
@@ -523,45 +523,6 @@ Blockly.FieldTextInput.prototype.resizeEditor_ = function() {
|
||||
div.style.top = xy.y + 'px';
|
||||
};
|
||||
|
||||
/**
|
||||
* Ensure that only a number may be entered.
|
||||
* @param {string} text The user's text.
|
||||
* @return {?string} A string representing a valid number, or null if invalid.
|
||||
* @deprecated
|
||||
*/
|
||||
Blockly.FieldTextInput.numberValidator = function(text) {
|
||||
Blockly.utils.deprecation.warn(
|
||||
'FieldTextInput.numberValidator',
|
||||
'May 2019',
|
||||
'December 2020',
|
||||
'Blockly.FieldNumber');
|
||||
if (text === null) {
|
||||
return null;
|
||||
}
|
||||
text = String(text);
|
||||
// TODO: Handle cases like 'ten', '1.203,14', etc.
|
||||
// 'O' is sometimes mistaken for '0' by inexperienced users.
|
||||
text = text.replace(/O/ig, '0');
|
||||
// Strip out thousands separators.
|
||||
text = text.replace(/,/g, '');
|
||||
var n = Number(text || 0);
|
||||
return isNaN(n) ? null : String(n);
|
||||
};
|
||||
|
||||
/**
|
||||
* Ensure that only a non-negative integer may be entered.
|
||||
* @param {string} text The user's text.
|
||||
* @return {?string} A string representing a valid int, or null if invalid.
|
||||
* @deprecated
|
||||
*/
|
||||
Blockly.FieldTextInput.nonnegativeIntegerValidator = function(text) {
|
||||
var n = Blockly.FieldTextInput.numberValidator(text);
|
||||
if (n) {
|
||||
n = String(Math.max(0, Math.floor(n)));
|
||||
}
|
||||
return n;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns whether or not the field is tab navigable.
|
||||
* @return {boolean} True if the field is tab navigable.
|
||||
|
||||
Reference in New Issue
Block a user