mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +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'
|
import styles from './InfoPanel.styl'
|
||||||
|
|
||||||
const InfoPanel = ({
|
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 className='infoPanel' styleName='control-infoButton-panel' style={{display: 'none'}}>
|
||||||
<div styleName='group-section'>
|
<div styleName='group-section'>
|
||||||
@@ -47,7 +47,15 @@ const InfoPanel = ({
|
|||||||
</div>
|
</div>
|
||||||
</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>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -56,7 +64,9 @@ InfoPanel.propTypes = {
|
|||||||
folderName: PropTypes.string.isRequired,
|
folderName: PropTypes.string.isRequired,
|
||||||
noteLink: PropTypes.string.isRequired,
|
noteLink: PropTypes.string.isRequired,
|
||||||
updatedAt: 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)
|
export default CSSModules(InfoPanel, styles)
|
||||||
|
|||||||
@@ -40,6 +40,9 @@
|
|||||||
width 160px
|
width 160px
|
||||||
height 25px
|
height 25px
|
||||||
|
|
||||||
|
.group-export
|
||||||
|
height 25px
|
||||||
|
|
||||||
body[data-theme="dark"]
|
body[data-theme="dark"]
|
||||||
.control-infoButton-panel
|
.control-infoButton-panel
|
||||||
background-color $ui-dark-noteList-backgroundColor
|
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) {
|
handleTrashButtonClick (e) {
|
||||||
let { note } = this.state
|
let { note } = this.state
|
||||||
const { isTrashed } = note
|
const { isTrashed } = note
|
||||||
@@ -352,6 +360,8 @@ class MarkdownNoteDetail extends React.Component {
|
|||||||
noteLink={`[${note.title}](${location.query.key})`}
|
noteLink={`[${note.title}](${location.query.key})`}
|
||||||
updatedAt={formatDate(note.updatedAt)}
|
updatedAt={formatDate(note.updatedAt)}
|
||||||
createdAt={formatDate(note.createdAt)}
|
createdAt={formatDate(note.createdAt)}
|
||||||
|
exportAsMd={this.exportAsMd}
|
||||||
|
exportAsTxt={this.exportAsTxt}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -466,6 +466,15 @@ class SnippetNoteDetail 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'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showWarning () {
|
||||||
|
dialog.showMessageBox(remote.getCurrentWindow(), {
|
||||||
|
type: 'warning',
|
||||||
|
message: 'Sorry!',
|
||||||
|
detail: 'md/text import is available only a markdown note.',
|
||||||
|
buttons: ['OK']
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
let { data, config, location } = this.props
|
let { data, config, location } = this.props
|
||||||
let { note } = this.state
|
let { note } = this.state
|
||||||
@@ -591,6 +600,8 @@ class SnippetNoteDetail extends React.Component {
|
|||||||
noteLink={`[${note.title}](${location.query.key})`}
|
noteLink={`[${note.title}](${location.query.key})`}
|
||||||
updatedAt={formatDate(note.updatedAt)}
|
updatedAt={formatDate(note.updatedAt)}
|
||||||
createdAt={formatDate(note.createdAt)}
|
createdAt={formatDate(note.createdAt)}
|
||||||
|
exportAsMd={this.showWarning}
|
||||||
|
exportAsTxt={this.showWarning}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user