Skip to content

Commit 45e75cd

Browse files
committed
added hotkey setting for direction toggle
1 parent 2cb4cbe commit 45e75cd

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

browser/main/Detail/MarkdownNoteDetail.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class MarkdownNoteDetail extends React.Component {
6363

6464
componentDidMount () {
6565
ee.on('topbar:togglelockbutton', this.toggleLockButton)
66+
ee.on('topbar:toggledirectionbutton', () => this.handleSwitchDirection())
6667
ee.on('topbar:togglemodebutton', () => {
6768
const reversedType = this.state.editorType === 'SPLIT' ? 'EDITOR_PREVIEW' : 'SPLIT'
6869
this.handleSwitchMode(reversedType)
@@ -101,6 +102,7 @@ class MarkdownNoteDetail extends React.Component {
101102

102103
componentWillUnmount () {
103104
ee.off('topbar:togglelockbutton', this.toggleLockButton)
105+
ee.on('topbar:toggledirectionbutton', this.handleSwitchDirection)
104106
ee.off('code:generate-toc', this.generateToc)
105107
if (this.saveQueue != null) this.saveNow()
106108
}

browser/main/lib/ConfigManager.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const DEFAULT_CONFIG = {
2929
hotkey: {
3030
toggleMain: OSX ? 'Command + Alt + L' : 'Super + Alt + E',
3131
toggleMode: OSX ? 'Command + Alt + M' : 'Ctrl + M',
32+
toggleDirection: OSX ? 'Command + Alt + Right' : 'Ctrl + Right',
3233
deleteNote: OSX ? 'Command + Shift + Backspace' : 'Ctrl + Shift + Backspace',
3334
pasteSmartly: OSX ? 'Command + Shift + V' : 'Ctrl + Shift + V',
3435
prettifyMarkdown: OSX ? 'Command + Shift + F' : 'Ctrl + Shift + F',

browser/main/lib/shortcut.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ module.exports = {
44
'toggleMode': () => {
55
ee.emit('topbar:togglemodebutton')
66
},
7+
'toggleDirection': () => {
8+
ee.emit('topbar:toggledirectionbutton')
9+
},
710
'deleteNote': () => {
811
ee.emit('hotkey:deletenote')
912
},

browser/main/modals/PreferencesModal/HotkeyTab.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ class HotkeyTab extends React.Component {
3030
this.handleSettingError = (err) => {
3131
if (
3232
this.state.config.hotkey.toggleMain === '' ||
33-
this.state.config.hotkey.toggleMode === ''
33+
this.state.config.hotkey.toggleMode === '' ||
34+
this.state.config.hotkey.toggleDirection === ''
3435
) {
3536
this.setState({keymapAlert: {
3637
type: 'success',
@@ -79,6 +80,7 @@ class HotkeyTab extends React.Component {
7980
config.hotkey = Object.assign({}, config.hotkey, {
8081
toggleMain: this.refs.toggleMain.value,
8182
toggleMode: this.refs.toggleMode.value,
83+
toggleDirection: this.refs.toggleDirection.value,
8284
deleteNote: this.refs.deleteNote.value,
8385
pasteSmartly: this.refs.pasteSmartly.value,
8486
prettifyMarkdown: this.refs.prettifyMarkdown.value,
@@ -154,6 +156,17 @@ class HotkeyTab extends React.Component {
154156
/>
155157
</div>
156158
</div>
159+
<div styleName='group-section'>
160+
<div styleName='group-section-label'>{i18n.__('Toggle Direction')}</div>
161+
<div styleName='group-section-control'>
162+
<input styleName='group-section-control-input'
163+
onChange={(e) => this.handleHotkeyChange(e)}
164+
ref='toggleDirection'
165+
value={config.hotkey.toggleDirection}
166+
type='text'
167+
/>
168+
</div>
169+
</div>
157170
<div styleName='group-section'>
158171
<div styleName='group-section-label'>{i18n.__('Delete Note')}</div>
159172
<div styleName='group-section-control'>

0 commit comments

Comments
 (0)