Fix autolinking for urls with non-English characters
Fixes #559 https://url.spec.whatwg.org/#url-code-points // FREEBIE
This commit is contained in:
parent
3d55f2c125
commit
d03d6fb7a5
1 changed files with 3 additions and 1 deletions
|
@ -5,6 +5,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
window.Whisper = window.Whisper || {};
|
window.Whisper = window.Whisper || {};
|
||||||
|
|
||||||
|
var URL_REGEX = /(^|[\s\n]|<br\/?>)((?:https?|ftp):\/\/[\-A-Z0-9\u00A0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFFD+\u0026\u2019@#\/%?=()~_|!:,.;]*[\-A-Z0-9+\u0026@#\/%=~()_|])/gi;
|
||||||
|
|
||||||
Whisper.MessageView = Whisper.View.extend({
|
Whisper.MessageView = Whisper.View.extend({
|
||||||
tagName: "li",
|
tagName: "li",
|
||||||
templateName: 'message',
|
templateName: 'message',
|
||||||
|
@ -89,7 +91,7 @@
|
||||||
|
|
||||||
var content = this.$('.content');
|
var content = this.$('.content');
|
||||||
var escaped = content.html();
|
var escaped = content.html();
|
||||||
content.html(escaped.replace(/\n/g, '<br>').replace(/(^|[\s\n]|<br\/?>)((?:https?|ftp):\/\/[\-A-Z0-9+\u0026\u2019@#\/%?=()~_|!:,.;]*[\-A-Z0-9+\u0026@#\/%=~()_|])/gi, "$1<a href='$2' target='_blank'>$2</a>"));
|
content.html(escaped.replace(/\n/g, '<br>').replace(URL_REGEX, "$1<a href='$2' target='_blank'>$2</a>"));
|
||||||
|
|
||||||
this.renderSent();
|
this.renderSent();
|
||||||
this.renderDelivered();
|
this.renderDelivered();
|
||||||
|
|
Loading…
Reference in a new issue