0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-27 13:42:38 +00:00

Merge pull request #1693 from Gazook89/fix-print-page-footer-issue

Add `.pages` container div to printPage.jsx
This commit is contained in:
Trevor Buckner
2021-09-17 21:52:14 -04:00
committed by GitHub
2 changed files with 19 additions and 13 deletions

View File

@@ -188,7 +188,6 @@ const BrewRenderer = createClass({
: null}
<Frame initialContent={this.state.initialContent}
head = <link href={`${this.props.renderer == 'legacy' ? '/themes/5ePhbLegacy.style.css' : '/themes/5ePhb.style.css'}`} rel='stylesheet'/>
style={{ width: '100%', height: '100%', visibility: this.state.visibility }}
contentDidMount={this.frameDidMount}>
<div className={'brewRenderer'}
@@ -200,17 +199,17 @@ const BrewRenderer = createClass({
<RenderWarnings />
<NotificationPopup />
</div>
<div className='pages' ref='pages'>
{/* Apply CSS from Style tab and render pages from Markdown tab */}
{this.state.isMounted
&&
<>
{this.renderStyle()}
<link href={`${this.props.renderer == 'legacy' ? '/themes/5ePhbLegacy.style.css' : '/themes/5ePhb.style.css'}`} rel='stylesheet'/>
{/* Apply CSS from Style tab and render pages from Markdown tab */}
{this.state.isMounted
&&
<>
{this.renderStyle()}
<div className='pages' ref='pages'>
{this.renderPages()}
</>
}
</div>
</div>
</>
}
</div>
</Frame>
{this.renderPageInfo()}

View File

@@ -35,6 +35,11 @@ const PrintPage = createClass({
if(this.props.query.dialog) window.print();
},
renderStyle : function() {
if(!this.props.brew.style) return;
return <div style={{ display: 'none' }} dangerouslySetInnerHTML={{ __html: `<style> ${this.props.brew.style} </style>` }} />;
},
renderPages : function(){
if(this.props.brew.renderer == 'legacy') {
return _.map(this.state.brewText.split('\\page'), (pageText, index)=>{
@@ -62,8 +67,10 @@ const PrintPage = createClass({
<Meta name='robots' content='noindex, nofollow' />
<link href={`${this.props.brew.renderer == 'legacy' ? '/themes/5ePhbLegacy.style.css' : '/themes/5ePhb.style.css'}`} rel='stylesheet'/>
{/* Apply CSS from Style tab */}
<div style={{ display: 'none' }} dangerouslySetInnerHTML={{ __html: `<style> ${this.props.brew.style} </style>` }} />
{this.renderPages()}
{this.renderStyle()}
<div className='pages' ref='pages'>
{this.renderPages()}
</div>
</div>;
}
});