Added protocol for correct absolute href
Allow mailto: links
This commit is contained in:
parent
0ef189abb2
commit
1acb530881
@ -3482,7 +3482,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
var regexAlphaNumericChars = "0-9\.\_" + regexAlphaChars;
|
var regexAlphaNumericChars = "0-9\.\_" + regexAlphaChars;
|
||||||
|
|
||||||
// Regular Expression for URL validation by Diego Perini
|
// Regular Expression for URL validation by Diego Perini
|
||||||
var urlRegex = "(?:(?:https?|ftp)://)?" +
|
var urlRegex = "((?:https?|ftp)://|mailto:)?" +
|
||||||
// user:pass authentication
|
// user:pass authentication
|
||||||
"(?:\\S+(?::\\S*)?@)?" +
|
"(?:\\S+(?::\\S*)?@)?" +
|
||||||
"(?:" +
|
"(?:" +
|
||||||
@ -3583,7 +3583,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
} else {
|
} else {
|
||||||
html.push(
|
html.push(
|
||||||
'<a href="',
|
'<a href="',
|
||||||
encodeEntities(match[4]),
|
encodeEntities((match[5] ? '' : 'http://') + match[4]),
|
||||||
'" target="_blank">',
|
'" target="_blank">',
|
||||||
encodeEntities(match[4]),
|
encodeEntities(match[4]),
|
||||||
'</a>'
|
'</a>'
|
||||||
@ -3593,15 +3593,15 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
html.push(encodeEntities(match[0]));
|
html.push(encodeEntities(match[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (match[5]) { // New line
|
else if (match[6]) { // New line
|
||||||
if (!options.noLinebreaks) {
|
if (!options.noLinebreaks) {
|
||||||
html.push('<br/>');
|
html.push('<br/>');
|
||||||
} else {
|
} else {
|
||||||
html.push(' ');
|
html.push(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (match[6]) {
|
else if (match[7]) {
|
||||||
if ((emojiCode = emojiMap[match[6]]) &&
|
if ((emojiCode = emojiMap[match[7]]) &&
|
||||||
(emojiCoords = getEmojiSpritesheetCoords(emojiCode))) {
|
(emojiCoords = getEmojiSpritesheetCoords(emojiCode))) {
|
||||||
|
|
||||||
emojiTitle = encodeEntities(emojiData[emojiCode][1][0]);
|
emojiTitle = encodeEntities(emojiData[emojiCode][1][0]);
|
||||||
@ -3618,13 +3618,13 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
':', emojiTitle, ':</span>'
|
':', emojiTitle, ':</span>'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
html.push(encodeEntities(match[6]));
|
html.push(encodeEntities(match[7]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (match[8]) {
|
else if (match[8]) {
|
||||||
if (!options.noLinks) {
|
if (!options.noLinks) {
|
||||||
html.push(
|
html.push(
|
||||||
match[7],
|
match[8],
|
||||||
'<a href="#/im?q=',
|
'<a href="#/im?q=',
|
||||||
encodeURIComponent(match[8]),
|
encodeURIComponent(match[8]),
|
||||||
'">',
|
'">',
|
||||||
@ -3633,7 +3633,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
html.push(
|
html.push(
|
||||||
match[7],
|
match[8],
|
||||||
encodeEntities(match[8])
|
encodeEntities(match[8])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user