Skip to content
Snippets Groups Projects
Commit f4d50ea4 authored by Benjamin Chodoroff's avatar Benjamin Chodoroff
Browse files

disable HtmlReady processing for HelpContent pages

closes #2539

we control this text, and it does not need to be readied
parent 2abb206e
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,7 @@ class MarkdownViewer extends Component { ...@@ -28,6 +28,7 @@ class MarkdownViewer extends Component {
highQualityPost: React.PropTypes.bool, highQualityPost: React.PropTypes.bool,
noImage: React.PropTypes.bool, noImage: React.PropTypes.bool,
allowDangerousHTML: React.PropTypes.bool, allowDangerousHTML: React.PropTypes.bool,
bypassHtmlReady: React.PropTypes.bool,
hideImages: React.PropTypes.bool, // whether to replace images with just a span containing the src url hideImages: React.PropTypes.bool, // whether to replace images with just a span containing the src url
// used for the ImageUserBlockList // used for the ImageUserBlockList
}; };
...@@ -36,6 +37,7 @@ class MarkdownViewer extends Component { ...@@ -36,6 +37,7 @@ class MarkdownViewer extends Component {
className: '', className: '',
large: false, large: false,
allowDangerousHTML: false, allowDangerousHTML: false,
bypassHtmlReady: false,
hideImages: false, hideImages: false,
}; };
...@@ -59,7 +61,12 @@ class MarkdownViewer extends Component { ...@@ -59,7 +61,12 @@ class MarkdownViewer extends Component {
}; };
render() { render() {
const { noImage, hideImages } = this.props; const {
noImage,
hideImages,
allowDangerousHTML,
bypassHtmlReady,
} = this.props;
const { allowNoImage } = this.state; const { allowNoImage } = this.state;
let { text } = this.props; let { text } = this.props;
if (!text) text = ''; // text can be empty, still view the link meta data if (!text) text = ''; // text can be empty, still view the link meta data
...@@ -93,13 +100,13 @@ class MarkdownViewer extends Component { ...@@ -93,13 +100,13 @@ class MarkdownViewer extends Component {
} }
// Embed videos, link mentions and hashtags, etc... // Embed videos, link mentions and hashtags, etc...
if (renderedText) if (renderedText && !bypassHtmlReady)
renderedText = HtmlReady(renderedText, { hideImages }).html; renderedText = HtmlReady(renderedText, { hideImages }).html;
// Complete removal of javascript and other dangerous tags.. // Complete removal of javascript and other dangerous tags..
// The must remain as close as possible to dangerouslySetInnerHTML // The must remain as close as possible to dangerouslySetInnerHTML
let cleanText = renderedText; let cleanText = renderedText;
if (this.props.allowDangerousHTML === true) { if (allowDangerousHTML === true) {
console.log('WARN\tMarkdownViewer rendering unsanitized content'); console.log('WARN\tMarkdownViewer rendering unsanitized content');
} else { } else {
cleanText = sanitize( cleanText = sanitize(
......
...@@ -145,6 +145,7 @@ export default class HelpContent extends React.Component { ...@@ -145,6 +145,7 @@ export default class HelpContent extends React.Component {
className="HelpContent" className="HelpContent"
text={value} text={value}
allowDangerousHTML allowDangerousHTML
bypassHtmlReady={true}
/> />
); );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment