From 8592fbd05bc6b78ebfebf524b40ce2b618fce549 Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Wed, 1 Apr 2026 12:00:00 +0800 Subject: [PATCH] support mask select fields --- src/snapshot.ts | 4 +--- src/types.ts | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/snapshot.ts b/src/snapshot.ts index 79d6c805..b3c50c3c 100644 --- a/src/snapshot.ts +++ b/src/snapshot.ts @@ -237,8 +237,6 @@ function serializeNode( tagName === 'select' ) { const value = (n as HTMLInputElement | HTMLTextAreaElement).value; - const needBlockTextarea = - tagName === 'textarea' && maskInputOptions.textarea; if ( attributes.type !== 'radio' && attributes.type !== 'checkbox' && @@ -248,7 +246,7 @@ function serializeNode( ) { attributes.value = maskInputOptions[attributes.type as keyof MaskInputOptions] || - needBlockTextarea + maskInputOptions[tagName as keyof MaskInputOptions] ? '*'.repeat(value.length) : value; } else if ((n as HTMLInputElement).checked) { diff --git a/src/types.ts b/src/types.ts index 1ec1109e..a5abef35 100644 --- a/src/types.ts +++ b/src/types.ts @@ -83,6 +83,7 @@ export type MaskInputOptions = Partial<{ time: boolean; url: boolean; week: boolean; - // unify textarea element with text input + // unify textarea and select element with text input textarea: boolean; + select: boolean; }>;