support mask select fields

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 80ef6a4007
commit 8592fbd05b
2 changed files with 3 additions and 4 deletions

View File

@@ -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) {

View File

@@ -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;
}>;