2
0
mirror of https://github.com/tenrok/maska.git synced 2026-06-05 16:42:28 +03:00

Fix of the input event

This commit is contained in:
Alexander Shabunevich
2022-12-09 22:40:51 +03:00
parent 4132dcc874
commit 41fb72b87c
2 changed files with 16 additions and 4 deletions
+9 -2
View File
@@ -86,7 +86,14 @@ export class MaskInput {
}
private readonly inputEvent = (e: Event | InputEvent): void => {
if (e instanceof InputEvent && e.data === '__MASKA__') return
if (
e instanceof CustomEvent &&
e.type === 'input' &&
e.detail != null &&
'masked' in e.detail
) {
return
}
const input = e.target as HTMLInputElement
const mask = this.items.get(input) as Mask
@@ -153,6 +160,6 @@ export class MaskInput {
}
}
input.dispatchEvent(new CustomEvent<MaskaDetail>('maska', { detail }))
input.dispatchEvent(new InputEvent('input', { data: '__MASKA__' }))
input.dispatchEvent(new CustomEvent<MaskaDetail>('input', { detail }))
}
}