0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-06 16:32:40 +00:00

iframe hotkey printing only works in Edit/Share/New

Default browser printing still works
This commit is contained in:
Trevor Buckner
2024-05-28 12:51:58 -04:00
parent 695b9916dd
commit b4349a0476
4 changed files with 10 additions and 2 deletions

View File

@@ -163,7 +163,7 @@ const BrewRenderer = (props)=>{
const handleControlKeys = (e)=>{ const handleControlKeys = (e)=>{
if(!(e.ctrlKey || e.metaKey)) return; if(!(e.ctrlKey || e.metaKey)) return;
const P_KEY = 80; const P_KEY = 80;
if(e.keyCode == P_KEY) printPage(); if(e.keyCode == P_KEY && props.allowPrint) printPage();
if(e.keyCode == P_KEY) { if(e.keyCode == P_KEY) {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();

View File

@@ -411,6 +411,7 @@ const EditPage = createClass({
errors={this.state.htmlErrors} errors={this.state.htmlErrors}
lang={this.state.brew.lang} lang={this.state.brew.lang}
currentEditorPage={this.state.currentEditorPage} currentEditorPage={this.state.currentEditorPage}
allowPrint={true}
/> />
</SplitPane> </SplitPane>
</div> </div>

View File

@@ -223,6 +223,7 @@ const NewPage = createClass({
errors={this.state.htmlErrors} errors={this.state.htmlErrors}
lang={this.state.brew.lang} lang={this.state.brew.lang}
currentEditorPage={this.state.currentEditorPage} currentEditorPage={this.state.currentEditorPage}
allowPrint={true}
/> />
</SplitPane> </SplitPane>
</div> </div>

View File

@@ -94,7 +94,13 @@ const SharePage = createClass({
</Navbar> </Navbar>
<div className='content'> <div className='content'>
<BrewRenderer text={this.props.brew.text} style={this.props.brew.style} renderer={this.props.brew.renderer} theme={this.props.brew.theme} /> <BrewRenderer
text={this.props.brew.text}
style={this.props.brew.style}
renderer={this.props.brew.renderer}
theme={this.props.brew.theme}
allowPrint={true}
/>
</div> </div>
</div>; </div>;
} }