Add support for bold, italics and strikethrough formatting in comments (#2475)
This commit is contained in:
parent
83d54bec39
commit
3e07114d47
|
@ -268,7 +268,8 @@ export default Vue.extend({
|
||||||
if (this.hideCommentLikes) {
|
if (this.hideCommentLikes) {
|
||||||
comment.likes = null
|
comment.likes = null
|
||||||
}
|
}
|
||||||
comment.text = autolinker.link(comment.text.replace(/(<(?!br>)([^>]+)>)/ig, ''))
|
// strip html tags but keep <br>, <b>, </b> <s>, </s>, <i>, </i>
|
||||||
|
comment.text = autolinker.link(comment.text.replace(/(<(?!br|\/?(?:b|s|i)>)([^>]+)>)/ig, ''))
|
||||||
if (comment.customEmojis.length > 0) {
|
if (comment.customEmojis.length > 0) {
|
||||||
comment.customEmojis.forEach(emoji => {
|
comment.customEmojis.forEach(emoji => {
|
||||||
comment.text = comment.text.replace(emoji.text, `<img width="14" height="14" class="commentCustomEmoji" alt="${emoji.text.substring(2, emoji.text.length - 1)}" src="${emoji.emojiThumbnails[0].url}">`)
|
comment.text = comment.text.replace(emoji.text, `<img width="14" height="14" class="commentCustomEmoji" alt="${emoji.text.substring(2, emoji.text.length - 1)}" src="${emoji.emojiThumbnails[0].url}">`)
|
||||||
|
|
Loading…
Reference in New Issue