Update link handling

This commit is contained in:
Scott Nonnenberg 2018-05-11 12:12:46 -07:00
parent d8e0a489b2
commit c00c939148

View file

@ -19,6 +19,8 @@
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({
templateName: 'error-icon',
className: 'error-icon-container',
@ -593,7 +595,11 @@
if (body.length > 0) {
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();