mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
Refactor markdown preview to minimize unsafe HTML. (#3842)
Fixes INS-805.
This commit is contained in:
parent
0178533e52
commit
eb67958846
@ -117,16 +117,12 @@ class MarkdownPreview extends PureComponent<Props, State> {
|
||||
render() {
|
||||
const { className, heading } = this.props;
|
||||
const { compiled, renderError } = this.state;
|
||||
const html = heading ? `<h1>${heading}</h1>\n${compiled}` : compiled;
|
||||
return (
|
||||
<div ref={this._setPreviewRef} className={classnames('markdown-preview', className)}>
|
||||
{renderError && <p className="notice error no-margin">Failed to render: {renderError}</p>}
|
||||
<div
|
||||
className="markdown-preview__content selectable"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: html,
|
||||
}}>
|
||||
{/* Set from above */}
|
||||
<div className="markdown-preview__content selectable">
|
||||
{heading ? <h1>{heading}</h1> : null}
|
||||
<div dangerouslySetInnerHTML={{ __html: compiled }}></div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user