summaryrefslogtreecommitdiffstats
path: root/webapp/utils/text_formatting.jsx
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-05-30 07:57:44 -0400
committerJoram Wilander <jwawilander@gmail.com>2016-05-30 07:57:44 -0400
commitfe5db123744c380bdddb36f196dd6cf7518d41cf (patch)
treed632ef9a576b1c6df54bc92c7f016e0f83bae7b8 /webapp/utils/text_formatting.jsx
parente1bebb2d776b12d6e1461e06f318e79fcb93ea2c (diff)
downloadchat-fe5db123744c380bdddb36f196dd6cf7518d41cf.tar.gz
chat-fe5db123744c380bdddb36f196dd6cf7518d41cf.tar.bz2
chat-fe5db123744c380bdddb36f196dd6cf7518d41cf.zip
PLT-3080 Added ability to disable formatting for debugging and updated marked to fix errors (#3141)
* Removed injectIntl from user_settings_advanced.jsx * Added setting to disable formatting for debugging * Updated fork of marked
Diffstat (limited to 'webapp/utils/text_formatting.jsx')
-rw-r--r--webapp/utils/text_formatting.jsx12
1 files changed, 9 insertions, 3 deletions
diff --git a/webapp/utils/text_formatting.jsx b/webapp/utils/text_formatting.jsx
index a4622ad9e..024e8e26e 100644
--- a/webapp/utils/text_formatting.jsx
+++ b/webapp/utils/text_formatting.jsx
@@ -6,6 +6,7 @@ import {browserHistory} from 'react-router';
import Constants from './constants.jsx';
import * as Emoticons from './emoticons.jsx';
import * as Markdown from './markdown.jsx';
+import PreferenceStore from 'stores/preference_store.jsx';
import UserStore from 'stores/user_store.jsx';
import twemoji from 'twemoji';
import * as Utils from './utils.jsx';
@@ -19,13 +20,18 @@ import * as Utils from './utils.jsx';
// - emoticons - Enables emoticon parsing. Defaults to true.
// - markdown - Enables markdown parsing. Defaults to true.
export function formatText(text, options = {}) {
- let output;
+ let output = text;
+
+ // would probably make more sense if it was on the calling components, but this option is intended primarily for debugging
+ if (PreferenceStore.get(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS, 'formatting', 'true') === 'false') {
+ return output;
+ }
if (!('markdown' in options) || options.markdown) {
// the markdown renderer will call doFormatText as necessary
- output = Markdown.format(text, options);
+ output = Markdown.format(output, options);
} else {
- output = sanitizeHtml(text);
+ output = sanitizeHtml(output);
output = doFormatText(output, options);
}