diff --git a/browser/main/Detail/MarkdownNoteDetail.js b/browser/main/Detail/MarkdownNoteDetail.js index 1067d256..a8fc938b 100755 --- a/browser/main/Detail/MarkdownNoteDetail.js +++ b/browser/main/Detail/MarkdownNoteDetail.js @@ -55,6 +55,10 @@ class MarkdownNoteDetail extends React.Component { componentDidMount () { ee.on('topbar:togglelockbutton', this.toggleLockButton) + ee.on('topbar:togglemodebutton', () => { + const reversedType = this.state.editorType === 'SPLIT' ? 'EDITOR_PREVIEW' : 'SPLIT' + this.handleSwitchMode(reversedType) + }) } componentWillReceiveProps (nextProps) { diff --git a/browser/main/index.js b/browser/main/index.js index 6e8bdcc5..a63d4995 100644 --- a/browser/main/index.js +++ b/browser/main/index.js @@ -9,6 +9,7 @@ import { syncHistoryWithStore } from 'react-router-redux' require('./lib/ipcClient') require('../lib/customMeta') import i18n from 'browser/lib/i18n' +import ee from 'browser/main/lib/eventEmitter' const electron = require('electron') @@ -63,6 +64,12 @@ document.addEventListener('keyup', function (e) { } }) +document.addEventListener('keydown', function(e) { + if (e.key === 'm' && e.ctrlKey) { + ee.emit('topbar:togglemodebutton') + } +}); + document.addEventListener('click', function (e) { const className = e.target.className if (!className && typeof (className) !== 'string') return