mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
added hotkey setting for direction toggle
This commit is contained in:
@@ -63,6 +63,7 @@ class MarkdownNoteDetail extends React.Component {
|
|||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
ee.on('topbar:togglelockbutton', this.toggleLockButton)
|
ee.on('topbar:togglelockbutton', this.toggleLockButton)
|
||||||
|
ee.on('topbar:toggledirectionbutton', () => this.handleSwitchDirection())
|
||||||
ee.on('topbar:togglemodebutton', () => {
|
ee.on('topbar:togglemodebutton', () => {
|
||||||
const reversedType = this.state.editorType === 'SPLIT' ? 'EDITOR_PREVIEW' : 'SPLIT'
|
const reversedType = this.state.editorType === 'SPLIT' ? 'EDITOR_PREVIEW' : 'SPLIT'
|
||||||
this.handleSwitchMode(reversedType)
|
this.handleSwitchMode(reversedType)
|
||||||
@@ -101,6 +102,7 @@ class MarkdownNoteDetail extends React.Component {
|
|||||||
|
|
||||||
componentWillUnmount () {
|
componentWillUnmount () {
|
||||||
ee.off('topbar:togglelockbutton', this.toggleLockButton)
|
ee.off('topbar:togglelockbutton', this.toggleLockButton)
|
||||||
|
ee.on('topbar:toggledirectionbutton', this.handleSwitchDirection)
|
||||||
ee.off('code:generate-toc', this.generateToc)
|
ee.off('code:generate-toc', this.generateToc)
|
||||||
if (this.saveQueue != null) this.saveNow()
|
if (this.saveQueue != null) this.saveNow()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export const DEFAULT_CONFIG = {
|
|||||||
hotkey: {
|
hotkey: {
|
||||||
toggleMain: OSX ? 'Command + Alt + L' : 'Super + Alt + E',
|
toggleMain: OSX ? 'Command + Alt + L' : 'Super + Alt + E',
|
||||||
toggleMode: OSX ? 'Command + Alt + M' : 'Ctrl + M',
|
toggleMode: OSX ? 'Command + Alt + M' : 'Ctrl + M',
|
||||||
|
toggleDirection: OSX ? 'Command + Alt + Right' : 'Ctrl + Right',
|
||||||
deleteNote: OSX ? 'Command + Shift + Backspace' : 'Ctrl + Shift + Backspace',
|
deleteNote: OSX ? 'Command + Shift + Backspace' : 'Ctrl + Shift + Backspace',
|
||||||
pasteSmartly: OSX ? 'Command + Shift + V' : 'Ctrl + Shift + V',
|
pasteSmartly: OSX ? 'Command + Shift + V' : 'Ctrl + Shift + V',
|
||||||
prettifyMarkdown: OSX ? 'Command + Shift + F' : 'Ctrl + Shift + F',
|
prettifyMarkdown: OSX ? 'Command + Shift + F' : 'Ctrl + Shift + F',
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ module.exports = {
|
|||||||
'toggleMode': () => {
|
'toggleMode': () => {
|
||||||
ee.emit('topbar:togglemodebutton')
|
ee.emit('topbar:togglemodebutton')
|
||||||
},
|
},
|
||||||
|
'toggleDirection': () => {
|
||||||
|
ee.emit('topbar:toggledirectionbutton')
|
||||||
|
},
|
||||||
'deleteNote': () => {
|
'deleteNote': () => {
|
||||||
ee.emit('hotkey:deletenote')
|
ee.emit('hotkey:deletenote')
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ class HotkeyTab extends React.Component {
|
|||||||
this.handleSettingError = (err) => {
|
this.handleSettingError = (err) => {
|
||||||
if (
|
if (
|
||||||
this.state.config.hotkey.toggleMain === '' ||
|
this.state.config.hotkey.toggleMain === '' ||
|
||||||
this.state.config.hotkey.toggleMode === ''
|
this.state.config.hotkey.toggleMode === '' ||
|
||||||
|
this.state.config.hotkey.toggleDirection === ''
|
||||||
) {
|
) {
|
||||||
this.setState({keymapAlert: {
|
this.setState({keymapAlert: {
|
||||||
type: 'success',
|
type: 'success',
|
||||||
@@ -79,6 +80,7 @@ class HotkeyTab extends React.Component {
|
|||||||
config.hotkey = Object.assign({}, config.hotkey, {
|
config.hotkey = Object.assign({}, config.hotkey, {
|
||||||
toggleMain: this.refs.toggleMain.value,
|
toggleMain: this.refs.toggleMain.value,
|
||||||
toggleMode: this.refs.toggleMode.value,
|
toggleMode: this.refs.toggleMode.value,
|
||||||
|
toggleDirection: this.refs.toggleDirection.value,
|
||||||
deleteNote: this.refs.deleteNote.value,
|
deleteNote: this.refs.deleteNote.value,
|
||||||
pasteSmartly: this.refs.pasteSmartly.value,
|
pasteSmartly: this.refs.pasteSmartly.value,
|
||||||
prettifyMarkdown: this.refs.prettifyMarkdown.value,
|
prettifyMarkdown: this.refs.prettifyMarkdown.value,
|
||||||
@@ -154,6 +156,17 @@ class HotkeyTab extends React.Component {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div styleName='group-section'>
|
||||||
|
<div styleName='group-section-label'>{i18n.__('Toggle Direction')}</div>
|
||||||
|
<div styleName='group-section-control'>
|
||||||
|
<input styleName='group-section-control-input'
|
||||||
|
onChange={(e) => this.handleHotkeyChange(e)}
|
||||||
|
ref='toggleDirection'
|
||||||
|
value={config.hotkey.toggleDirection}
|
||||||
|
type='text'
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div styleName='group-section'>
|
<div styleName='group-section'>
|
||||||
<div styleName='group-section-label'>{i18n.__('Delete Note')}</div>
|
<div styleName='group-section-label'>{i18n.__('Delete Note')}</div>
|
||||||
<div styleName='group-section-control'>
|
<div styleName='group-section-control'>
|
||||||
|
|||||||
Reference in New Issue
Block a user