1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

Add exports to infoPanel

This commit is contained in:
asmsuechan
2017-07-15 19:33:58 +09:00
parent b21baf1ce5
commit 6ea2b5e1d9
4 changed files with 37 additions and 3 deletions

View File

@@ -3,7 +3,7 @@ import CSSModules from 'browser/lib/CSSModules'
import styles from './InfoPanel.styl'
const InfoPanel = ({
storageName, folderName, noteLink, updatedAt, createdAt
storageName, folderName, noteKey, updatedAt, createdAt, exportAsMd, exportAsTxt
}) => (
<div className='infoPanel' styleName='control-infoButton-panel' style={{display: 'none'}}>
<div styleName='group-section'>
@@ -47,7 +47,15 @@ const InfoPanel = ({
</div>
</div>
<div styleName='group-export' />
<div styleName='group-export'>
<i className='fa fa-file-text fa-fw'
onClick={(e) => exportAsMd(e)}
/>
<i className='fa fa-file-text fa-fw'
onClick={(e) => exportAsTxt(e)}
/>
</div>
</div>
)
@@ -56,7 +64,9 @@ InfoPanel.propTypes = {
folderName: PropTypes.string.isRequired,
noteLink: PropTypes.string.isRequired,
updatedAt: PropTypes.string.isRequired,
createdAt: PropTypes.string.isRequired
createdAt: PropTypes.string.isRequired,
exportAsMd: PropTypes.func.isRequired,
exportAsTxt: PropTypes.func.isRequired
}
export default CSSModules(InfoPanel, styles)

View File

@@ -40,6 +40,9 @@
width 160px
height 25px
.group-export
height 25px
body[data-theme="dark"]
.control-infoButton-panel
background-color $ui-dark-noteList-backgroundColor

View File

@@ -175,6 +175,14 @@ class MarkdownNoteDetail extends React.Component {
}
exportAsMd () {
ee.emit('export:save-md')
}
exportAsTxt () {
ee.emit('export:save-text')
}
handleTrashButtonClick (e) {
let { note } = this.state
const { isTrashed } = note
@@ -352,6 +360,8 @@ class MarkdownNoteDetail extends React.Component {
noteLink={`[title](${location.query.key})`}
updatedAt={formatDate(note.updatedAt)}
createdAt={formatDate(note.createdAt)}
exportAsMd={this.exportAsMd}
exportAsTxt={this.exportAsTxt}
/>
</div>
</div>

View File

@@ -466,6 +466,15 @@ class SnippetNoteDetail extends React.Component {
if (infoPanel.style) infoPanel.style.display = infoPanel.style.display === 'none' ? 'inline' : 'none'
}
showWarning () {
dialog.showMessageBox(remote.getCurrentWindow(), {
type: 'warning',
message: 'Sorry!',
detail: 'md/text import is available only a markdown note.',
buttons: ['OK', 'Cancel']
})
}
render () {
let { data, config, location } = this.props
let { note } = this.state
@@ -591,6 +600,8 @@ class SnippetNoteDetail extends React.Component {
noteLink={`[title](${location.query.key})`}
updatedAt={formatDate(note.updatedAt)}
createdAt={formatDate(note.createdAt)}
exportAsMd={this.showWarning}
exportAsTxt={this.showWarning}
/>
</div>
</div>