1
0
mirror of https://github.com/BoostIo/Boostnote synced 2026-01-27 15:47:15 +00:00

Merge pull request #245 from asmsuechan/add-md-and-text-exporter

Add export as txt/md
This commit is contained in:
Sota Sugiura
2017-01-21 15:54:01 +09:00
committed by GitHub
3 changed files with 75 additions and 0 deletions

View File

@@ -38,6 +38,9 @@ class NoteList extends React.Component {
this.focusHandler = () => {
this.refs.list.focus()
}
this.alertIfSnippetHnalder = () => {
this.alertIfSnippet()
}
this.state = {
}
@@ -48,6 +51,7 @@ class NoteList extends React.Component {
ee.on('list:next', this.selectNextNoteHandler)
ee.on('list:prior', this.selectPriorNoteHandler)
ee.on('list:focus', this.focusHandler)
ee.on('list:isMarkdownNote', this.alertIfSnippetHnalder)
}
componentWillReceiveProps (nextProps) {
@@ -66,6 +70,7 @@ class NoteList extends React.Component {
ee.off('list:next', this.selectNextNoteHandler)
ee.off('list:prior', this.selectPriorNoteHandler)
ee.off('list:focus', this.focusHandler)
ee.off('list:isMarkdownNote', this.alertIfSnippetHnalder)
}
componentDidUpdate (prevProps) {
@@ -305,6 +310,20 @@ class NoteList extends React.Component {
})
}
alertIfSnippet() {
let { location } = this.props
const targetIndex = _.findIndex(this.notes, (note) => {
return `${note.storage}-${note.key}` === location.query.key
})
if (this.notes[targetIndex].type === 'SNIPPET_NOTE') {
dialog.showMessageBox(remote.getCurrentWindow(), {
type: 'warning',
message: 'Sorry!',
detail: 'md/text import is available only a markdown note.'
})
}
}
render () {
let { location, notes, config } = this.props
let sortFunc = config.sortBy === 'CREATED_AT'