The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Rocket.Chat/app/ui-utils/client/lib/renderMessageBody.js

11 lines
416 B

import { callbacks } from 'meteor/rocketchat:callbacks';
import s from 'underscore.string';
export const renderMessageBody = (message) => {
message.html = s.trim(message.msg) ? s.escapeHTML(message.msg) : '';
const { tokens, html } = callbacks.run('renderMessage', message);
return (Array.isArray(tokens) ? tokens.reverse() : [])
.reduce((html, { token, text }) => html.replace(token, () => text), html);
};