1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-23 14:41:44 +00:00

esc to show preview when rightclick to toggle set

This commit is contained in:
Rokt33r
2016-01-19 18:58:27 +09:00
parent fb8a2eb2e0
commit da0222f213
3 changed files with 12 additions and 1 deletions

View File

@@ -102,6 +102,10 @@ export default class ArticleDetail extends React.Component {
if (isModalOpen()) return true
if (this.refs.editor) this.refs.editor.switchEditMode()
}
this.previewHandler = e => {
if (isModalOpen()) return true
if (this.refs.editor) this.refs.editor.switchPreviewMode()
}
this.state = {
article: Object.assign({content: ''}, props.activeArticle),
@@ -120,6 +124,7 @@ export default class ArticleDetail extends React.Component {
ipc.on('detail-uncache', this.uncacheHandler)
ipc.on('detail-title', this.titleHandler)
ipc.on('detail-edit', this.editHandler)
ipc.on('detail-preview', this.previewHandler)
}
componentWillUnmount () {
@@ -130,6 +135,7 @@ export default class ArticleDetail extends React.Component {
ipc.removeListener('detail-uncache', this.uncacheHandler)
ipc.removeListener('detail-title', this.titleHandler)
ipc.removeListener('detail-edit', this.editHandler)
ipc.removeListener('detail-preview', this.previewHandler)
}
componentDidUpdate (prevProps, prevState) {