mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-03 09:54:54 +08:00
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:
parent
0ec4ea6fa8
commit
55d3e92f50
5 changed files with 31 additions and 10 deletions
|
@ -154,8 +154,7 @@ class ComposerView extends React.Component
|
||||||
@_proxy.changes.commit()
|
@_proxy.changes.commit()
|
||||||
|
|
||||||
render: ->
|
render: ->
|
||||||
<KeyCommandsRegion localHandlers={@_keymapHandlers()}
|
<KeyCommandsRegion localHandlers={@_keymapHandlers()} >
|
||||||
className="composer-outer-wrap">
|
|
||||||
{@_renderComposerWrap()}
|
{@_renderComposerWrap()}
|
||||||
</KeyCommandsRegion>
|
</KeyCommandsRegion>
|
||||||
|
|
||||||
|
@ -172,7 +171,7 @@ class ComposerView extends React.Component
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
_wrapClasses: =>
|
_wrapClasses: =>
|
||||||
"message-item-white-wrap #{@props.className ? ""}"
|
"message-item-white-wrap composer-outer-wrap #{@props.className ? ""}"
|
||||||
|
|
||||||
_renderComposer: =>
|
_renderComposer: =>
|
||||||
<DropZone className="composer-inner-wrap"
|
<DropZone className="composer-inner-wrap"
|
||||||
|
|
|
@ -74,9 +74,10 @@ class ThreadList extends React.Component
|
||||||
name: "★"
|
name: "★"
|
||||||
resolver: (thread) =>
|
resolver: (thread) =>
|
||||||
[
|
[
|
||||||
<ThreadListIcon thread={thread} />
|
<ThreadListIcon key="thread-list-icon" thread={thread} />
|
||||||
<MailImportantIcon thread={thread} />
|
<MailImportantIcon key="mail-important-icon" thread={thread} />
|
||||||
<InjectedComponentSet
|
<InjectedComponentSet
|
||||||
|
key="injected-component-set"
|
||||||
inline={true}
|
inline={true}
|
||||||
containersRequired={false}
|
containersRequired={false}
|
||||||
matching={role: "ThreadListIcon"}
|
matching={role: "ThreadListIcon"}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
'body':
|
'body':
|
||||||
'cmd-m': 'application:minimize'
|
'cmd-m': 'application:minimize'
|
||||||
'cmd-h': 'application:hide'
|
'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-alt-h': 'application:hide-other-applications'
|
||||||
'cmd-ctrl-f': 'window:toggle-full-screen'
|
'cmd-ctrl-f': 'window:toggle-full-screen'
|
||||||
'alt-cmd-ctrl-m': 'application:zoom'
|
'alt-cmd-ctrl-m': 'application:zoom'
|
||||||
|
|
|
@ -54,6 +54,16 @@
|
||||||
'shift-pageup' : 'core:list-page-up'
|
'shift-pageup' : 'core:list-page-up'
|
||||||
'shift-pagedown': 'core:list-page-down'
|
'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. ###
|
### N1 developer commands. ###
|
||||||
'cmdctrl-alt-l': 'window:reload'
|
'cmdctrl-alt-l': 'window:reload'
|
||||||
'cmdctrl-alt-i': 'window:toggle-dev-tools'
|
'cmdctrl-alt-i': 'window:toggle-dev-tools'
|
||||||
|
|
|
@ -33,16 +33,27 @@ class AccountStore
|
||||||
if newAccountIds.length > 0
|
if newAccountIds.length > 0
|
||||||
Actions.selectAccountId(newAccountIds[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: =>
|
_load: =>
|
||||||
@_accounts = []
|
@_accounts = []
|
||||||
for json in atom.config.get(saveObjectsKey) || []
|
for json in atom.config.get(saveObjectsKey) || []
|
||||||
@_accounts.push((new Account).fromJSON(json))
|
@_accounts.push((new Account).fromJSON(json))
|
||||||
|
|
||||||
index = atom.config.get(saveIndexKey) || 0
|
index = atom.config.get(saveIndexKey) || 0
|
||||||
@_index = Math.min(@_accounts.length - 1, Math.max(0, index))
|
@_selectAccountByIndex(index)
|
||||||
|
|
||||||
@_tokens = atom.config.get(saveTokensKey) || {}
|
|
||||||
@trigger()
|
|
||||||
|
|
||||||
_save: =>
|
_save: =>
|
||||||
atom.config.set(saveObjectsKey, @_accounts)
|
atom.config.set(saveObjectsKey, @_accounts)
|
||||||
|
|
Loading…
Add table
Reference in a new issue