Skip to content

Commit 9ea5345

Browse files
committed
support mask select fields
1 parent f6781fd commit 9ea5345

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/snapshot.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,6 @@ function serializeNode(
237237
tagName === 'select'
238238
) {
239239
const value = (n as HTMLInputElement | HTMLTextAreaElement).value;
240-
const needBlockTextarea =
241-
tagName === 'textarea' && maskInputOptions.textarea;
242240
if (
243241
attributes.type !== 'radio' &&
244242
attributes.type !== 'checkbox' &&
@@ -248,7 +246,7 @@ function serializeNode(
248246
) {
249247
attributes.value =
250248
maskInputOptions[attributes.type as keyof MaskInputOptions] ||
251-
needBlockTextarea
249+
maskInputOptions[tagName as keyof MaskInputOptions]
252250
? '*'.repeat(value.length)
253251
: value;
254252
} else if ((n as HTMLInputElement).checked) {

src/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export type MaskInputOptions = Partial<{
8383
time: boolean;
8484
url: boolean;
8585
week: boolean;
86-
// unify textarea element with text input
86+
// unify textarea and select element with text input
8787
textarea: boolean;
88+
select: boolean;
8889
}>;

0 commit comments

Comments
 (0)