diff --git a/src/snapshot.ts b/src/snapshot.ts index edc91231..79d6c805 100644 --- a/src/snapshot.ts +++ b/src/snapshot.ts @@ -237,6 +237,8 @@ function serializeNode( tagName === 'select' ) { const value = (n as HTMLInputElement | HTMLTextAreaElement).value; + const needBlockTextarea = + tagName === 'textarea' && maskInputOptions.textarea; if ( attributes.type !== 'radio' && attributes.type !== 'checkbox' && @@ -244,11 +246,11 @@ function serializeNode( attributes.type !== 'button' && value ) { - attributes.value = maskInputOptions[ - attributes.type as keyof MaskInputOptions - ] - ? '*'.repeat(value.length) - : value; + attributes.value = + maskInputOptions[attributes.type as keyof MaskInputOptions] || + needBlockTextarea + ? '*'.repeat(value.length) + : value; } else if ((n as HTMLInputElement).checked) { attributes.checked = (n as HTMLInputElement).checked; } diff --git a/src/types.ts b/src/types.ts index 78582c66..1ec1109e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -83,4 +83,6 @@ export type MaskInputOptions = Partial<{ time: boolean; url: boolean; week: boolean; + // unify textarea element with text input + textarea: boolean; }>;