2
0
mirror of https://github.com/tenrok/maska.git synced 2026-06-11 18:02:27 +03:00

Fix eager mask bug #128

This commit is contained in:
Alexander Shabunevich
2023-01-29 16:59:24 +03:00
parent ea47223566
commit 056b6fb855
2 changed files with 82 additions and 5 deletions
+2 -5
View File
@@ -105,16 +105,13 @@ export class MaskInput {
let value = valueOld
if (mask.isEager()) {
const masked = mask.masked(valueOld)
const unmasked = mask.unmasked(valueOld)
const maskedUnmasked = mask.masked(unmasked)
if (unmasked === '' && 'data' in e && e.data != null) {
// empty state and something like `space` pressed
value = e.data
} else if (
maskedUnmasked.startsWith(valueOld) ||
mask.completed(unmasked)
) {
} else if (unmasked !== mask.unmasked(masked)) {
value = unmasked
}
}