0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-07 05:32:41 +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} : null}
<Frame initialContent={this.state.initialContent} <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 }} style={{ width: '100%', height: '100%', visibility: this.state.visibility }}
contentDidMount={this.frameDidMount}> contentDidMount={this.frameDidMount}>
<div className={'brewRenderer'} <div className={'brewRenderer'}
@@ -200,17 +199,17 @@ const BrewRenderer = createClass({
<RenderWarnings /> <RenderWarnings />
<NotificationPopup /> <NotificationPopup />
</div> </div>
<link href={`${this.props.renderer == 'legacy' ? '/themes/5ePhbLegacy.style.css' : '/themes/5ePhb.style.css'}`} rel='stylesheet'/>
<div className='pages' ref='pages'> {/* Apply CSS from Style tab and render pages from Markdown tab */}
{/* Apply CSS from Style tab and render pages from Markdown tab */} {this.state.isMounted
{this.state.isMounted &&
&& <>
<> {this.renderStyle()}
{this.renderStyle()} <div className='pages' ref='pages'>
{this.renderPages()} {this.renderPages()}
</> </div>
} </>
</div> }
</div> </div>
</Frame> </Frame>
{this.renderPageInfo()} {this.renderPageInfo()}

View File

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