fix(undo): properly scope composer keymappings for undo/redo

Summary: Properly scopes undo & redo key bindings to the composer

Test Plan: manual

Reviewers: dillon, bengotow

Reviewed By: bengotow

Maniphest Tasks: T3446

Differential Revision: https://phab.nylas.com/D1951
This commit is contained in:
Evan Morikawa 2015-08-28 18:59:00 -04:00
parent 4fddec48d9
commit 6ee161eb72
5 changed files with 31 additions and 15 deletions

View file

@ -2,6 +2,8 @@
div[contenteditable]':
'cmd-B' : 'composer:show-and-focus-bcc'
'cmd-C' : 'composer:show-and-focus-cc'
'ctrl-B' : 'composer:show-and-focus-bcc'
'ctrl-C' : 'composer:show-and-focus-cc'
'cmd-enter' : 'composer:send-message'
'ctrl-enter' : 'composer:send-message'
@ -15,3 +17,18 @@ div[contenteditable]':
'enter' : 'composer:send-message'
'tab' : 'composer:focus-to'
'shift-tab' : 'native!'
'body.platform-win32 .composer-outer-wrap *[contenteditable], body.platform-win32 .composer-outer-wrap input':
'ctrl-z': 'composer:undo'
'ctrl-Z': 'composer:redo'
'ctrl-y': 'composer:redo'
'body.platform-linux .composer-outer-wrap *[contenteditable], body.platform-linux .composer-outer-wrap input':
'ctrl-z': 'composer:undo'
'ctrl-Z': 'composer:redo'
'ctrl-y': 'composer:redo'
'body.platform-darwin .composer-outer-wrap *[contenteditable], body.platform-darwin .composer-outer-wrap input':
'cmd-z': 'composer:undo'
'cmd-Z': 'composer:redo'
'cmd-y': 'composer:redo'

View file

@ -82,8 +82,8 @@ class ComposerView extends React.Component
'composer:focus-to': => @focus "textFieldTo"
'composer:send-message': => @_sendDraft()
'composer:delete-empty-draft': => @_deleteDraftIfEmpty()
"core:undo": @undo
"core:redo": @redo
"composer:undo": @undo
"composer:redo": @redo
}
if @props.mode is "fullwindow"
# Need to delay so the component can be fully painted. Focus doesn't
@ -736,5 +736,4 @@ class ComposerView extends React.Component
return unless @_proxy
if @_proxy.draft().pristine then Actions.destroyDraft(@props.draftClientId)
module.exports = ComposerView

View file

@ -33,7 +33,7 @@
'ctrl-alt-cmd-l': 'window:reload'
'cmd-alt-ctrl-p': 'application:run-package-specs'
'body div *[contenteditable]':
'cmd-z': 'core:undo'
'cmd-Z': 'core:redo'
'cmd-y': 'core:redo'
'body *[contenteditable]':
'cmd-z': 'native!'
'cmd-Z': 'native!'
'cmd-y': 'native!'

View file

@ -30,7 +30,7 @@
'ctrl-alt-s': 'application:run-all-specs'
'F11': 'window:toggle-full-screen'
'body div *[contenteditable]':
'ctrl-z': 'core:undo'
'ctrl-Z': 'core:redo'
'ctrl-y': 'core:redo'
'body *[contenteditable]':
'ctrl-z': 'native!'
'ctrl-Z': 'native!'
'ctrl-y': 'native!'

View file

@ -37,7 +37,7 @@
'ctrl-alt-s': 'application:run-all-specs'
'F11': 'window:toggle-full-screen'
'body div *[contenteditable]':
'ctrl-z': 'core:undo'
'ctrl-Z': 'core:redo'
'ctrl-y': 'core:redo'
'body *[contenteditable]':
'ctrl-z': 'native!'
'ctrl-Z': 'native!'
'ctrl-y': 'native!'