0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 22:52:40 +00:00

Merge pull request #1457 from G-Ambatte/fixUndefinedCSS

Fix issue with undefined Style tab data
This commit is contained in:
Trevor Buckner
2021-07-30 18:53:16 -04:00
committed by GitHub

View File

@@ -122,6 +122,11 @@ const BrewRenderer = createClass({
</div>;
},
renderStyle : function() {
if(!this.props.style) return;
return <div style={{ display: 'none' }} dangerouslySetInnerHTML={{ __html: `<style> ${this.props.style} </style>` }} />;
},
renderPage : function(pageText, index){
if(this.props.renderer == 'legacy')
return <div className='phb page' id={`p${index + 1}`} dangerouslySetInnerHTML={{ __html: MarkdownLegacy.render(pageText) }} key={index} />;
@@ -191,14 +196,14 @@ const BrewRenderer = createClass({
</div>
<div className='pages' ref='pages'>
{/* Apply CSS from Style tab */}
<div style={{ display: 'none' }} dangerouslySetInnerHTML={{ __html: `<style> ${this.props.style} </style>` }} />
{/* Render pages from Markdown tab */}
{/* Apply CSS from Style tab and render pages from Markdown tab */}
{this.state.isMounted
? this.renderPages()
: null}
&&
<>
{this.renderStyle()}
{this.renderPages()}
</>
}
</div>
</div>
</Frame>