-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better rendering of message attachment text
- Loading branch information
1 parent
6b34363
commit 0d5d13c
Showing
5 changed files
with
42 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/rocketchat-ui-message/message/renderMessageBody.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* global renderMessageBody:true */ | ||
renderMessageBody = function(msg) { | ||
var message; | ||
|
||
msg.html = msg.msg; | ||
|
||
if (_.trim(msg.html) !== '') { | ||
msg.html = _.escapeHTML(msg.html); | ||
} | ||
|
||
message = RocketChat.callbacks.run('renderMessage', msg); | ||
|
||
if (message.tokens && message.tokens.length > 0) { | ||
for (var i = 0, len = message.tokens.length; i < len; i++) { | ||
let token = message.tokens[i]; | ||
token.text = token.text.replace(/([^\$])(\$[^\$])/gm, '$1$$$2'); | ||
message.html = message.html.replace(token.token, token.text); | ||
} | ||
} | ||
|
||
msg.html = message.html.replace(/\n/gm, '<br/>'); | ||
|
||
return msg.html; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters