Update link handling
This commit is contained in:
parent
d8e0a489b2
commit
c00c939148
1 changed files with 7 additions and 1 deletions
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
window.Whisper = window.Whisper || {};
|
window.Whisper = window.Whisper || {};
|
||||||
|
|
||||||
|
const URL_REGEX = /(^|[\s\n]|<br\/?>)((?:https?|ftp):\/\/[-A-Z0-9\u00A0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFFD+\u0026\u2019@#/%?=()~_|!:,.;]*[-A-Z0-9+\u0026@#/%=~()_|])/gi;
|
||||||
|
|
||||||
const ErrorIconView = Whisper.View.extend({
|
const ErrorIconView = Whisper.View.extend({
|
||||||
templateName: 'error-icon',
|
templateName: 'error-icon',
|
||||||
className: 'error-icon-container',
|
className: 'error-icon-container',
|
||||||
|
@ -593,7 +595,11 @@
|
||||||
|
|
||||||
if (body.length > 0) {
|
if (body.length > 0) {
|
||||||
const escapedBody = body.html();
|
const escapedBody = body.html();
|
||||||
body.html(Signal.HTML.render(escapedBody));
|
body.html(
|
||||||
|
escapedBody
|
||||||
|
.replace(/\n/g, '<br>')
|
||||||
|
.replace(URL_REGEX, "$1<a href='$2' target='_blank'>$2</a>")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.renderSent();
|
this.renderSent();
|
||||||
|
|
Loading…
Reference in a new issue