Only linkify http urls, not mailto urls.

This commit is contained in:
Martin Edenhofer 2018-01-30 00:34:58 +01:00
parent 5e3f854cca
commit 90f4b03e07
2 changed files with 18 additions and 1 deletions

View file

@ -161,7 +161,14 @@ window.linkify = (function(){
} }
// Push massaged link onto the array // Push massaged link onto the array
parts.push([ link, href ]); // 2018-10-30: me only link urls, not mailto link
//parts.push([ link, href ]);
if ( href && href.substr && href.substr(0,7) != 'mailto:') {
parts.push([ link, href ]);
}
else {
parts.push([ link, undefined ]);
}
}; };
// Push remaining non-link text onto the array. // Push remaining non-link text onto the array.

View file

@ -269,6 +269,16 @@ test("linkify", function() {
result = App.Utils.linkify(source) result = App.Utils.linkify(source)
equal(result, should, source) equal(result, should, source)
source = "test@example.com some text"
should = 'test@example.com some text'
result = App.Utils.linkify(source)
equal(result, should, source)
source = "abc test@example.com some text"
should = 'abc test@example.com some text'
result = App.Utils.linkify(source)
equal(result, should, source)
/* /*
source = "<b>example.com</b>" source = "<b>example.com</b>"
should = '<b><a href="http://example.com" title="http://example.com" target="_blank">http://example.com</a></b>' should = '<b><a href="http://example.com" title="http://example.com" target="_blank">http://example.com</a></b>'