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

Commit 631adb6

Browse files
committed
Adds the same sanitizer settings to chat as used in the medium editor, specifically allowing href attributes in anchor elements.
1 parent 625c00f commit 631adb6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

js/views/chatMessageVw.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ module.exports = baseVw.extend({
3232
$msg;
3333

3434
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' ]
35+
allowedTags: [ 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'a', 'u', 'ul', 'ol', 'nl', 'li', 'b', 'i', 'strong', 'em', 'strike', 'hr', 'br', 'img' ],
36+
allowedAttributes: {
37+
'a': [ 'href', 'title', 'alt' ],
38+
'img': [ 'src', 'style']
39+
},
40+
allowedSchemes: [ 'http', 'https', 'ftp', 'mailto', 'ob' ]
3641
});
3742

3843
// add js-externalLink class to any links in the message text
@@ -52,7 +57,7 @@ module.exports = baseVw.extend({
5257
)
5358
);
5459
});
55-
60+
5661
return this;
5762
}
58-
});
63+
});

0 commit comments

Comments
 (0)