feat: Added support maskInputFn with HTMLElement (#1188)

This commit is contained in:
Ben White
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 23388f2d00
commit ec5e536891
11 changed files with 917 additions and 9 deletions

View File

@@ -154,12 +154,14 @@ export function createMirror(): Mirror {
}
export function maskInputValue({
element,
maskInputOptions,
tagName,
type,
value,
maskInputFn,
}: {
element: HTMLElement;
maskInputOptions: MaskInputOptions;
tagName: string;
type: string | null;
@@ -174,7 +176,7 @@ export function maskInputValue({
(actualType && maskInputOptions[actualType as keyof MaskInputOptions])
) {
if (maskInputFn) {
text = maskInputFn(text);
text = maskInputFn(text, element);
} else {
text = '*'.repeat(text.length);
}