Skip to content

Commit 77a7bf0

Browse files
Sarah LeventhalRonaldJerez
authored andcommitted
feat(core.js): allow for turning on and off the masking
1 parent 39b743f commit 77a7bf0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/component.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export default {
9898
}
9999
},
100100
mask(newMask) {
101-
if (!newMask) {
101+
if (!newMask && !this.masked) {
102102
// when removing the masking rule, set the displayed value to the unmasked
103103
// to remove any unwanted masking characters from the input
104104
this.maskedValue = this.unmaskedValue
@@ -112,6 +112,7 @@ export default {
112112
config() {
113113
return {
114114
mask: this.mask,
115+
masked: this.masked,
115116
tokens: this.tokens,
116117
formatter: this.formatter,
117118
prefill: this.prefill,

src/core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export function updateCursor(event, originalValue, originalPosition) {
9797
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange
9898
const supportedInputType = ['text', 'tel', 'search', null].includes(target.getAttribute('type'))
9999
const config = target[CONFIG_KEY] && target[CONFIG_KEY].config
100-
if (target !== document.activeElement || !supportedInputType || !config.mask) {
100+
if (target !== document.activeElement || !supportedInputType || (!config.mask && !config.masked)) {
101101
return
102102
}
103103

0 commit comments

Comments
 (0)