mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
Merge pull request #709 from asmsuechan/add-exports-to-infoPanel
Add exports to infoPanel
This commit is contained in:
@@ -3,7 +3,7 @@ import CSSModules from 'browser/lib/CSSModules'
|
||||
import styles from './InfoPanel.styl'
|
||||
|
||||
const InfoPanel = ({
|
||||
storageName, folderName, noteLink, updatedAt, createdAt
|
||||
storageName, folderName, noteLink, 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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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={`[${note.title}](${location.query.key})`}
|
||||
updatedAt={formatDate(note.updatedAt)}
|
||||
createdAt={formatDate(note.createdAt)}
|
||||
exportAsMd={this.exportAsMd}
|
||||
exportAsTxt={this.exportAsTxt}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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']
|
||||
})
|
||||
}
|
||||
|
||||
render () {
|
||||
let { data, config, location } = this.props
|
||||
let { note } = this.state
|
||||
@@ -591,6 +600,8 @@ class SnippetNoteDetail extends React.Component {
|
||||
noteLink={`[${note.title}](${location.query.key})`}
|
||||
updatedAt={formatDate(note.updatedAt)}
|
||||
createdAt={formatDate(note.createdAt)}
|
||||
exportAsMd={this.showWarning}
|
||||
exportAsTxt={this.showWarning}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user