1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

Merge pull request #2208 from enyaxu/feature/2132

New Feature: Shortcuts for focusing tag editor(CmdOrControl+Shift+T)(#2132)
This commit is contained in:
Junyoung Choi (Sai)
2018-08-09 17:53:54 +09:00
committed by GitHub
3 changed files with 22 additions and 1 deletions

View File

@@ -441,7 +441,7 @@ class SnippetNoteDetail extends React.Component {
const isSuper = global.process.platform === 'darwin' const isSuper = global.process.platform === 'darwin'
? e.metaKey ? e.metaKey
: e.ctrlKey : e.ctrlKey
if (isSuper) { if (isSuper && !e.shiftKey) {
e.preventDefault() e.preventDefault()
this.addSnippet() this.addSnippet()
} }

View File

@@ -5,6 +5,7 @@ import styles from './TagSelect.styl'
import _ from 'lodash' import _ from 'lodash'
import AwsMobileAnalyticsConfig from 'browser/main/lib/AwsMobileAnalyticsConfig' import AwsMobileAnalyticsConfig from 'browser/main/lib/AwsMobileAnalyticsConfig'
import i18n from 'browser/lib/i18n' import i18n from 'browser/lib/i18n'
import ee from 'browser/main/lib/eventEmitter'
class TagSelect extends React.Component { class TagSelect extends React.Component {
constructor (props) { constructor (props) {
@@ -13,16 +14,26 @@ class TagSelect extends React.Component {
this.state = { this.state = {
newTag: '' newTag: ''
} }
this.addtagHandler = this.handleAddTag.bind(this)
} }
componentDidMount () { componentDidMount () {
this.value = this.props.value this.value = this.props.value
ee.on('editor:add-tag', this.addtagHandler)
} }
componentDidUpdate () { componentDidUpdate () {
this.value = this.props.value this.value = this.props.value
} }
componentWillUnmount () {
ee.off('editor:add-tag', this.addtagHandler)
}
handleAddTag () {
this.refs.newTag.focus()
}
handleNewTagInputKeyDown (e) { handleNewTagInputKeyDown (e) {
switch (e.keyCode) { switch (e.keyCode) {
case 9: case 9:

View File

@@ -218,6 +218,16 @@ const edit = {
label: 'Select All', label: 'Select All',
accelerator: 'Command+A', accelerator: 'Command+A',
selector: 'selectAll:' selector: 'selectAll:'
},
{
type: 'separator'
},
{
label: 'Add Tag',
accelerator: 'CommandOrControl+Shift+T',
click () {
mainWindow.webContents.send('editor:add-tag')
}
} }
] ]
} }