mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-22 04:21:44 +00:00
[Mint Token] Automatically switch the typed text to uppercase in symbol input
allow uppercase ASCII only input, up to 6 characters Fixes #11201
This commit is contained in:
parent
26c4eaa75b
commit
62fec738a1
@ -183,10 +183,10 @@ StatusScrollView {
|
||||
regexValidator.errorMessage: qsTr("Your token symbol contains invalid characters (use A-Z only)")
|
||||
regexValidator.regularExpression: Constants.regularExpressions.capitalOnly
|
||||
extraValidator.validate: function (value) {
|
||||
// If minted failed, we can retry same deployment, so same symbol allowed
|
||||
var allowRepeatedName = (root.isAssetView ? asset.deployState : collectible.deployState) === Constants.ContractTransactionStatus.Failed
|
||||
// If minting failed, we can retry same deployment, so same symbol allowed
|
||||
const allowRepeatedName = (root.isAssetView ? asset.deployState : collectible.deployState) === Constants.ContractTransactionStatus.Failed
|
||||
if(allowRepeatedName)
|
||||
if(symbolInput.text === root.referenceSymbol)
|
||||
if(symbolInput.text.toUpperCase() === root.referenceSymbol.toUpperCase())
|
||||
return true
|
||||
|
||||
// Otherwise, no repeated names allowed:
|
||||
@ -195,10 +195,14 @@ StatusScrollView {
|
||||
extraValidator.errorMessage: qsTr("You have used this token symbol before")
|
||||
|
||||
onTextChanged: {
|
||||
const cursorPos = input.edit.cursorPosition
|
||||
const upperSymbol = text.toUpperCase()
|
||||
if(root.isAssetView)
|
||||
asset.symbol = text
|
||||
asset.symbol = upperSymbol
|
||||
else
|
||||
collectible.symbol = text
|
||||
collectible.symbol = upperSymbol
|
||||
text = upperSymbol // breaking the binding on purpose but so does validate() and onTextChanged() internal handler
|
||||
input.edit.cursorPosition = cursorPos
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user