feat(keymap): add cmd+1, cmd+2, etc to quick-select accounts

Fix "unique key" for react props

Fix composer styling bug in popout composer
This commit is contained in:
Evan Morikawa 2015-11-06 14:37:33 -08:00
parent 0ec4ea6fa8
commit 55d3e92f50
5 changed files with 31 additions and 10 deletions

View file

@ -154,8 +154,7 @@ class ComposerView extends React.Component
@_proxy.changes.commit()
render: ->
<KeyCommandsRegion localHandlers={@_keymapHandlers()}
className="composer-outer-wrap">
<KeyCommandsRegion localHandlers={@_keymapHandlers()} >
{@_renderComposerWrap()}
</KeyCommandsRegion>
@ -172,7 +171,7 @@ class ComposerView extends React.Component
</div>
_wrapClasses: =>
"message-item-white-wrap #{@props.className ? ""}"
"message-item-white-wrap composer-outer-wrap #{@props.className ? ""}"
_renderComposer: =>
<DropZone className="composer-inner-wrap"

View file

@ -74,9 +74,10 @@ class ThreadList extends React.Component
name: "★"
resolver: (thread) =>
[
<ThreadListIcon thread={thread} />
<MailImportantIcon thread={thread} />
<ThreadListIcon key="thread-list-icon" thread={thread} />
<MailImportantIcon key="mail-important-icon" thread={thread} />
<InjectedComponentSet
key="injected-component-set"
inline={true}
containersRequired={false}
matching={role: "ThreadListIcon"}

View file

@ -7,7 +7,7 @@
'body':
'cmd-m': 'application:minimize'
'cmd-h': 'application:hide'
'cmd-1': 'application:show-main-window'
'cmd-shift-1': 'application:show-main-window'
'cmd-alt-h': 'application:hide-other-applications'
'cmd-ctrl-f': 'window:toggle-full-screen'
'alt-cmd-ctrl-m': 'application:zoom'

View file

@ -54,6 +54,16 @@
'shift-pageup' : 'core:list-page-up'
'shift-pagedown': 'core:list-page-down'
'cmdctrl-1': 'application:select-account-0'
'cmdctrl-2': 'application:select-account-1'
'cmdctrl-3': 'application:select-account-2'
'cmdctrl-4': 'application:select-account-3'
'cmdctrl-5': 'application:select-account-4'
'cmdctrl-6': 'application:select-account-5'
'cmdctrl-7': 'application:select-account-6'
'cmdctrl-8': 'application:select-account-7'
'cmdctrl-9': 'application:select-account-8'
### N1 developer commands. ###
'cmdctrl-alt-l': 'window:reload'
'cmdctrl-alt-i': 'window:toggle-dev-tools'

View file

@ -33,16 +33,27 @@ class AccountStore
if newAccountIds.length > 0
Actions.selectAccountId(newAccountIds[0])
atom.commands.add 'body', @_accountSwitchCommands()
_accountSwitchCommands: ->
commands = {}
[0..8].forEach (index) =>
key = "application:select-account-#{index}"
commands[key] = _.partial(@_selectAccountByIndex, index)
return commands
_selectAccountByIndex: (index) =>
@_index = Math.min(@_accounts.length - 1, Math.max(0, index))
atom.config.set(saveIndexKey, @_index)
@trigger()
_load: =>
@_accounts = []
for json in atom.config.get(saveObjectsKey) || []
@_accounts.push((new Account).fromJSON(json))
index = atom.config.get(saveIndexKey) || 0
@_index = Math.min(@_accounts.length - 1, Math.max(0, index))
@_tokens = atom.config.get(saveTokensKey) || {}
@trigger()
@_selectAccountByIndex(index)
_save: =>
atom.config.set(saveObjectsKey, @_accounts)