mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03: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) {
|
if (v.obj) {
|
||||||
let li = createElement('li',{title:v.obj.toLine(),draggable:'true'}),
|
let li = createElement('li',{title:v.obj.toLine(),draggable:'true'}),
|
||||||
el = createElement('span');
|
el = createElement('span');
|
||||||
el.append(v.obj.toLine(true, false, true));
|
el.append(v.obj.toLine(true));
|
||||||
li.append(el);
|
li.append(el);
|
||||||
|
|
||||||
el = createElement('a',{href:'#', class:'ficon'});
|
el = createElement('a',{href:'#', class:'ficon'});
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import { encodeHtml } from 'Common/Html';
|
|
||||||
|
|
||||||
import { AbstractModel } from 'Knoin/AbstractModel';
|
import { AbstractModel } from 'Knoin/AbstractModel';
|
||||||
|
|
||||||
|
|
@ -333,45 +332,13 @@ export class EmailModel extends AbstractModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {boolean} friendlyView = false
|
* @param {boolean} friendlyView = false
|
||||||
* @param {boolean=} wrapWithLink = false
|
|
||||||
* @param {boolean=} useEncodeHtml = false
|
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
toLine(friendlyView, wrapWithLink, useEncodeHtml) {
|
toLine(friendlyView) {
|
||||||
let result = '',
|
let result = this.email;
|
||||||
toLink = (to, txt) => '<a href="mailto:' + to + '" target="_blank" tabindex="-1">' + encodeHtml(txt) + '</a>';
|
return (result && this.name)
|
||||||
if (this.email) {
|
? (friendlyView ? this.name : '"' + this.name + '" <' + result + '>')
|
||||||
if (friendlyView && this.name) {
|
: result;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static splitEmailLine(line) {
|
static splitEmailLine(line) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue