mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-12-27 01:28:56 +08: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) {
|
||||
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._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() {
|
||||
let self = this;
|
||||
[...self.ul.children].forEach(node => node !== self.inputCont && node.remove());
|
||||
|
|
Loading…
Reference in a new issue