0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-25 22:42:41 +00:00

Fix issue with undefined Style tab data

This commit is contained in:
G.Ambatte
2021-07-26 10:29:31 +12:00
parent 3948e17da2
commit 41e1ed7bd1

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} />;
@@ -189,7 +194,9 @@ const BrewRenderer = createClass({
<div className='pages' ref='pages'>
{/* Apply CSS from Style tab */}
<div style={{ display: 'none' }} dangerouslySetInnerHTML={{ __html: `<style> ${this.props.style} </style>` }} />
{this.state.isMounted
? this.renderStyle()
: null}
{/* Render pages from Markdown tab */}
{this.state.isMounted