mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
improve: address input: space character can trigger '_parseValue' if the email address looks complete
This commit is contained in:
parent
d97ccf0cfb
commit
dadb6b86c3
1 changed files with 10 additions and 1 deletions
|
|
@ -165,7 +165,9 @@ export class EmailAddressesComponent {
|
||||||
|
|
||||||
_parseInput(force) {
|
_parseInput(force) {
|
||||||
let val = this.input.value;
|
let val = this.input.value;
|
||||||
if ((force || val.includes(',') || val.includes(';')) && this._parseValue(val)) {
|
if ((force || val.includes(',') || val.includes(';')
|
||||||
|
|| (val.charAt(val.length-1)===' ' && this._simpleEmailMatch(val)))
|
||||||
|
&& this._parseValue(val)) {
|
||||||
this.input.value = '';
|
this.input.value = '';
|
||||||
}
|
}
|
||||||
this._resizeInput();
|
this._resizeInput();
|
||||||
|
|
@ -284,6 +286,13 @@ export class EmailAddressesComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_simpleEmailMatch(value) {
|
||||||
|
// A very SIMPLE test to check if the value might be an email
|
||||||
|
const val = value.trim();
|
||||||
|
return /^[^@]*<[^\s@]{1,128}@[^\s@]{1,256}\.[\w]{2,32}>$/g.test(val)
|
||||||
|
|| /^[^\s@]{1,128}@[^\s@]{1,256}\.[\w]{2,32}$/g.test(val);
|
||||||
|
}
|
||||||
|
|
||||||
_renderTags() {
|
_renderTags() {
|
||||||
let self = this;
|
let self = this;
|
||||||
[...self.ul.children].forEach(node => node !== self.inputCont && node.remove());
|
[...self.ul.children].forEach(node => node !== self.inputCont && node.remove());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue