tweak some code for mask input option
This commit is contained in:
@@ -379,7 +379,21 @@ function initViewportResizeObserver(
|
||||
}
|
||||
|
||||
const INPUT_TAGS = ['INPUT', 'TEXTAREA', 'SELECT'];
|
||||
const MASK_TYPES = ['color', 'date', 'datetime-local', 'email', 'month', 'number', 'range', 'search', 'tel', 'text', 'time', 'url', 'week']
|
||||
const MASK_TYPES = [
|
||||
'color',
|
||||
'date',
|
||||
'datetime-local',
|
||||
'email',
|
||||
'month',
|
||||
'number',
|
||||
'range',
|
||||
'search',
|
||||
'tel',
|
||||
'text',
|
||||
'time',
|
||||
'url',
|
||||
'week',
|
||||
];
|
||||
const lastInputValueMap: WeakMap<EventTarget, inputValue> = new WeakMap();
|
||||
function initInputObserver(
|
||||
cb: inputCallback,
|
||||
@@ -406,10 +420,12 @@ function initInputObserver(
|
||||
}
|
||||
let text = (target as HTMLInputElement).value;
|
||||
let isChecked = false;
|
||||
const hasTextInput =
|
||||
MASK_TYPES.includes(type) || (target as Element).tagName === 'TEXTAREA';
|
||||
if (type === 'radio' || type === 'checkbox') {
|
||||
isChecked = (target as HTMLInputElement).checked;
|
||||
} else if ((MASK_TYPES.indexOf(type) >= 0 || (target as Element).tagName == 'TEXTAREA') && maskAllInputs) {
|
||||
text = Array(text.length+1).join('*')
|
||||
} else if (hasTextInput && maskAllInputs) {
|
||||
text = '*'.repeat(text.length);
|
||||
}
|
||||
cbWithDedup(target, { text, isChecked });
|
||||
// if a radio was checked
|
||||
|
||||
Reference in New Issue
Block a user