mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-12-28 18:41:34 +08:00
Resolve #484
This commit is contained in:
parent
d2f8f507a1
commit
f3009ee781
2 changed files with 6 additions and 39 deletions
|
@ -262,7 +262,7 @@ export class EmailAddressesComponent {
|
|||
if (v.obj) {
|
||||
let li = createElement('li',{title:v.obj.toLine(),draggable:'true'}),
|
||||
el = createElement('span');
|
||||
el.append(v.obj.toLine(true, false, true));
|
||||
el.append(v.obj.toLine(true));
|
||||
li.append(el);
|
||||
|
||||
el = createElement('a',{href:'#', class:'ficon'});
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { encodeHtml } from 'Common/Html';
|
||||
|
||||
import { AbstractModel } from 'Knoin/AbstractModel';
|
||||
|
||||
|
@ -333,45 +332,13 @@ export class EmailModel extends AbstractModel {
|
|||
|
||||
/**
|
||||
* @param {boolean} friendlyView = false
|
||||
* @param {boolean=} wrapWithLink = false
|
||||
* @param {boolean=} useEncodeHtml = false
|
||||
* @returns {string}
|
||||
*/
|
||||
toLine(friendlyView, wrapWithLink, useEncodeHtml) {
|
||||
let result = '',
|
||||
toLink = (to, txt) => '<a href="mailto:' + to + '" target="_blank" tabindex="-1">' + encodeHtml(txt) + '</a>';
|
||||
if (this.email) {
|
||||
if (friendlyView && this.name) {
|
||||
result = wrapWithLink
|
||||
? toLink(
|
||||
encodeHtml(this.email) + '?to=' + encodeURIComponent('"' + this.name + '" <' + this.email + '>'),
|
||||
this.name
|
||||
)
|
||||
: (useEncodeHtml ? encodeHtml(this.name) : this.name);
|
||||
} else {
|
||||
result = this.email;
|
||||
if (this.name) {
|
||||
if (wrapWithLink) {
|
||||
result =
|
||||
encodeHtml('"' + this.name + '" <')
|
||||
+ toLink(
|
||||
encodeHtml(this.email) + '?to=' + encodeURIComponent('"' + this.name + '" <' + this.email + '>'),
|
||||
result
|
||||
)
|
||||
+ encodeHtml('>');
|
||||
} else {
|
||||
result = '"' + this.name + '" <' + result + '>';
|
||||
if (useEncodeHtml) {
|
||||
result = encodeHtml(result);
|
||||
}
|
||||
}
|
||||
} else if (wrapWithLink) {
|
||||
result = toLink(encodeHtml(this.email), this.email);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
toLine(friendlyView) {
|
||||
let result = this.email;
|
||||
return (result && this.name)
|
||||
? (friendlyView ? this.name : '"' + this.name + '" <' + result + '>')
|
||||
: result;
|
||||
}
|
||||
|
||||
static splitEmailLine(line) {
|
||||
|
|
Loading…
Reference in a new issue