1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-14 02:06:29 +00:00

Replace pdf to print

This commit is contained in:
asmsuechan
2017-10-13 09:29:41 +09:00
parent 6a3062709c
commit 5255708ff2
2 changed files with 11 additions and 5 deletions

View File

@@ -3,7 +3,7 @@ import CSSModules from 'browser/lib/CSSModules'
import styles from './InfoPanel.styl' import styles from './InfoPanel.styl'
const InfoPanel = ({ const InfoPanel = ({
storageName, folderName, noteLink, updatedAt, createdAt, exportAsMd, exportAsTxt, wordCount, letterCount, type storageName, folderName, noteLink, updatedAt, createdAt, exportAsMd, exportAsTxt, wordCount, letterCount, type, print
}) => ( }) => (
<div className='infoPanel' styleName='control-infoButton-panel' style={{display: 'none'}}> <div className='infoPanel' styleName='control-infoButton-panel' style={{display: 'none'}}>
<div styleName='group-section'> <div styleName='group-section'>
@@ -79,9 +79,9 @@ const InfoPanel = ({
<p>.txt</p> <p>.txt</p>
</button> </button>
<button styleName='export--unable'> <button styleName='export--enable' onClick={(e) => print(e)}>
<i className='fa fa-file-pdf-o fa-fw' /> <i className='fa fa-print fa-fw' />
<p>.pdf</p> <p>Print</p>
</button> </button>
</div> </div>
</div> </div>
@@ -97,7 +97,8 @@ InfoPanel.propTypes = {
exportAsTxt: PropTypes.func.isRequired, exportAsTxt: PropTypes.func.isRequired,
wordCount: PropTypes.number, wordCount: PropTypes.number,
letterCount: PropTypes.number, letterCount: PropTypes.number,
type: PropTypes.string.isRequired type: PropTypes.string.isRequired,
print: PropTypes.func.isRequired
} }
export default CSSModules(InfoPanel, styles) export default CSSModules(InfoPanel, styles)

View File

@@ -256,6 +256,10 @@ class MarkdownNoteDetail extends React.Component {
if (infoPanel.style) infoPanel.style.display = infoPanel.style.display === 'none' ? 'inline' : 'none' if (infoPanel.style) infoPanel.style.display = infoPanel.style.display === 'none' ? 'inline' : 'none'
} }
print (e) {
ee.emit('print')
}
render () { render () {
let { data, config, location } = this.props let { data, config, location } = this.props
let { note } = this.state let { note } = this.state
@@ -357,6 +361,7 @@ class MarkdownNoteDetail extends React.Component {
wordCount={note.content.split(' ').length} wordCount={note.content.split(' ').length}
letterCount={note.content.replace(/\r?\n/g, '').length} letterCount={note.content.replace(/\r?\n/g, '').length}
type={note.type} type={note.type}
print={this.print}
/> />
</div> </div>
</div> </div>