Skip to content

Commit fb24efd

Browse files
committed
added shortcut for toggle mode
1 parent c9cb31b commit fb24efd

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

browser/main/Detail/MarkdownNoteDetail.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ class MarkdownNoteDetail extends React.Component {
5555

5656
componentDidMount () {
5757
ee.on('topbar:togglelockbutton', this.toggleLockButton)
58+
ee.on('topbar:togglemodebutton', () => {
59+
const reversedType = this.state.editorType === 'SPLIT' ? 'EDITOR_PREVIEW' : 'SPLIT'
60+
this.handleSwitchMode(reversedType)
61+
})
5862
}
5963

6064
componentWillReceiveProps (nextProps) {

browser/main/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { syncHistoryWithStore } from 'react-router-redux'
99
require('./lib/ipcClient')
1010
require('../lib/customMeta')
1111
import i18n from 'browser/lib/i18n'
12+
import ee from 'browser/main/lib/eventEmitter'
1213

1314
const electron = require('electron')
1415

@@ -63,6 +64,12 @@ document.addEventListener('keyup', function (e) {
6364
}
6465
})
6566

67+
document.addEventListener('keydown', function(e) {
68+
if (e.key === 'm' && e.ctrlKey) {
69+
ee.emit('topbar:togglemodebutton')
70+
}
71+
});
72+
6673
document.addEventListener('click', function (e) {
6774
const className = e.target.className
6875
if (!className && typeof (className) !== 'string') return

0 commit comments

Comments
 (0)