diff options
author | Reed Garmsen <rgarmsen2295@gmail.com> | 2015-07-08 11:34:34 -0700 |
---|---|---|
committer | Reed Garmsen <rgarmsen2295@gmail.com> | 2015-08-12 11:19:42 -0700 |
commit | d293bc0b799a679cd27ed4ef6e818b0ca96998d9 (patch) | |
tree | 6b12bb2d447cbe9cf24f0ea66ec096e6233c87d7 /web/react/components/sidebar.jsx | |
parent | 95e6626f9f59b876479d8267b6c95105345e661d (diff) | |
download | chat-d293bc0b799a679cd27ed4ef6e818b0ca96998d9.tar.gz chat-d293bc0b799a679cd27ed4ef6e818b0ca96998d9.tar.bz2 chat-d293bc0b799a679cd27ed4ef6e818b0ca96998d9.zip |
Implemented basic text formatting package using a modfied version of the marked js library. Supports *bold*, _italics_, and `code`
Diffstat (limited to 'web/react/components/sidebar.jsx')
-rw-r--r-- | web/react/components/sidebar.jsx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx index fe73cbcf7..d6711f29c 100644 --- a/web/react/components/sidebar.jsx +++ b/web/react/components/sidebar.jsx @@ -11,6 +11,7 @@ var BrowserStore = require('../stores/browser_store.jsx'); var utils = require('../utils/utils.jsx'); var SidebarHeader = require('./sidebar_header.jsx'); var SearchBox = require('./search_bar.jsx'); +var formatText = require('../../static/js/marked/lib/marked.js'); var Constants = require('../utils/constants.jsx'); var ActionTypes = Constants.ActionTypes; @@ -207,6 +208,11 @@ module.exports = React.createClass({ utils.notifyMe(title, username + ' did something new', channel); } } else { + var allowTextFormatting = config.AllowTextFormatting; + if (allowTextFormatting) { + notifyText = formatText(notifyText, {sanitize: false, mangle: false, gfm: true, breaks: true, tables: false, smartypants: true, renderer: utils.customMarkedRenderer({disable: true})}); + } + notifyText = utils.replaceHtmlEntities(notifyText); utils.notifyMe(title, username + ' wrote: ' + notifyText, channel); } if (!user.notify_props || user.notify_props.desktop_sound === 'true') { |