Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit eeb01cd

Browse files
authored
Merge pull request #1804 from OpenBazaar/allowHrefInAnchorInChat
Adds the same sanitizer settings to chat as used in the medium editor…
2 parents 625c00f + 7d09bb3 commit eeb01cd

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

js/views/chatMessageVw.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
var __ = require('underscore'),
44
$ = require('jquery'),
55
moment = require('moment'),
6-
sanitizeHTML = require('sanitize-html'),
76
loadTemplate = require('../utils/loadTemplate'),
87
app = require('../App.js').getApp(),
98
baseVw = require('./baseVw');
@@ -29,14 +28,11 @@ module.exports = baseVw.extend({
2928

3029
render: function(){
3130
var sanitizedMsg,
31+
msgTxt = this.model.get('message'),
3232
$msg;
3333

34-
sanitizedMsg = sanitizeHTML(this.model.get('message').replace(/\n$/, '').split(/[\r\n]/g).join('<br/><br/>'), {
35-
allowedTags: [ 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'a', 'u', 'ul', 'ol', 'nl', 'li', 'b', 'i', 'strong', 'em', 'strike', 'hr', 'br', 'img' ]
36-
});
37-
3834
// add js-externalLink class to any links in the message text
39-
$msg = $('<div>' + sanitizedMsg + '</div>');
35+
$msg = $('<div>' + msgTxt + '</div>');
4036
$msg.find('a').addClass('js-externalLink');
4137
sanitizedMsg = $msg.html();
4238

@@ -52,7 +48,7 @@ module.exports = baseVw.extend({
5248
)
5349
);
5450
});
55-
51+
5652
return this;
5753
}
58-
});
54+
});

0 commit comments

Comments
 (0)