mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-04 06:18:24 +08:00
fix(keymaps): Restore missing bindings, handle single keys inside of email frames
This commit is contained in:
parent
01fb81ff4e
commit
a270234f6d
8 changed files with 50 additions and 28 deletions
|
@ -196,8 +196,11 @@ class PreferencesKeymaps extends React.Component {
|
|||
_renderKeystrokes = (keystrokes, idx) => {
|
||||
const elements = [];
|
||||
const splitKeystrokes = keystrokes.split(' ');
|
||||
splitKeystrokes.forEach((keystroke) => {
|
||||
splitKeystrokes.forEach((keystroke, kidx) => {
|
||||
elements.push(<span key={keystroke}>{this._formatKeystrokes(keystroke)}</span>);
|
||||
if (kidx < splitKeystrokes.length - 1) {
|
||||
elements.push(<span className="then" key={kidx}> then </span>);
|
||||
}
|
||||
});
|
||||
return (
|
||||
<span key={`keystrokes-${idx}`} className="shortcut-value">{elements}</span>
|
||||
|
|
|
@ -173,6 +173,11 @@
|
|||
font-family: monospace;
|
||||
font-weight: 600;
|
||||
color: @text-color;
|
||||
|
||||
.then {
|
||||
font-size:0.9em;
|
||||
color: @text-color-very-subtle;
|
||||
}
|
||||
&:after {
|
||||
content: ", "
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
"core:print-thread": "mod+p",
|
||||
"core:focus-item": "enter",
|
||||
"core:remove-from-view": "backspace",
|
||||
"core:remove-from-view": ["backspace", "delete"],
|
||||
"core:pop-sheet": "escape",
|
||||
|
||||
"core:messages-page-up": "pageup",
|
||||
|
@ -54,9 +54,9 @@
|
|||
"contenteditable:quote": "mod+(",
|
||||
"contenteditable:outdent": "mod+[",
|
||||
"contenteditable:indent": "mod+]",
|
||||
"contenteditable:align-left": "mod+L",
|
||||
"contenteditable:align-center": "mod+E",
|
||||
"contenteditable:align-right": "mod+R",
|
||||
"contenteditable:align-left": "mod+shift+l",
|
||||
"contenteditable:align-center": "mod+shift+e",
|
||||
"contenteditable:align-right": "mod+shift+r",
|
||||
"contenteditable:set-left-to-right": "mod+.",
|
||||
"contenteditable:remove-formatting": "mod+\\",
|
||||
"contenteditable:previous-font": "mod+%",
|
||||
|
|
|
@ -30,13 +30,13 @@
|
|||
"message-list:expand-all": ";",
|
||||
"message-list:collapse-all": ":",
|
||||
|
||||
"application:new-message": "mod+n",
|
||||
"application:new-message": ["c", "d", "mod+n"],
|
||||
"application:more-actions": ".",
|
||||
"application:open-help": "?",
|
||||
|
||||
"core:mute-conversation": "m",
|
||||
"core:focus-search": "/",
|
||||
"core:change-category": "v",
|
||||
"core:change-category": ["l", "v"],
|
||||
"core:focus-toolbar": ",",
|
||||
"core:star-item": "s",
|
||||
"core:gmail-remove-from-view": "y",
|
||||
|
@ -44,17 +44,18 @@
|
|||
"core:report-as-spam": "!",
|
||||
"core:delete-item": "#",
|
||||
|
||||
"core:reply": "mod+r",
|
||||
"core:reply": ["r", "mod+r"],
|
||||
"core:reply-new-window": "shift+r",
|
||||
"core:reply-all": "mod+shift+r",
|
||||
"core:reply-all": ["a", "mod+shift+r"],
|
||||
"core:reply-all-new-window": "shift+a",
|
||||
"core:forward": "mod+shift+f",
|
||||
"core:forward": ["f", "mod+shift+f"],
|
||||
"core:forward-new-window": "shift+f",
|
||||
"core:remove-and-previous": "}",
|
||||
"core:remove-and-next": "{",
|
||||
|
||||
"core:remove-and-previous": ["}", "]"],
|
||||
"core:remove-and-next": ["{", "["],
|
||||
|
||||
"core:mark-as-read": "shift+i",
|
||||
"core:mark-as-unread": "_",
|
||||
"core:mark-important": "=",
|
||||
"core:mark-as-unread": ["shift+u", "_"],
|
||||
"core:mark-important": ["+", "="],
|
||||
"core:mark-unimportant": "-"
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"application:new-message": "mod+n",
|
||||
"application:new-message": ["c", "mod+n"],
|
||||
|
||||
"navigation:go-to-inbox": "i",
|
||||
"multiselect-list:select-all": "shift+x",
|
||||
|
@ -21,14 +21,16 @@
|
|||
"core:gmail-remove-from-view": "y",
|
||||
"core:archive-item": "e",
|
||||
"core:report-as-spam": "!",
|
||||
"core:delete-item": "//",
|
||||
"core:reply": "mod+r",
|
||||
"core:delete-item": "#",
|
||||
|
||||
"core:reply": ["r", "mod+r"],
|
||||
"core:reply-new-window": "shift+r",
|
||||
"core:reply-all": "mod+shift+r",
|
||||
"core:reply-all": ["a", "mod+shift+r"],
|
||||
"core:reply-all-new-window": "shift+a",
|
||||
"core:forward": "mod+shift+f",
|
||||
"core:forward": ["f", "mod+shift+f"],
|
||||
"core:forward-new-window": "shift+f",
|
||||
"core:remove-and-previous": "}",
|
||||
"core:remove-and-next": "{",
|
||||
|
||||
"core:remove-and-previous": ["}", "]"],
|
||||
"core:remove-and-next": ["{", "["],
|
||||
"core:undo": "z"
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"core:change-category": "mod+shift+v",
|
||||
"core:focus-search": "mod+e",
|
||||
"core:focus-search": ["f3", "mod+e"],
|
||||
"core:forward": "mod+f",
|
||||
"core:delete-item": "mod+d",
|
||||
"core:undo": "alt+backspace",
|
||||
"composer:send-message": "alt+s",
|
||||
"core:reply": "mod+r",
|
||||
"core:reply-all": "mod+shift+r",
|
||||
"application:new-message": "mod+shift+m",
|
||||
"application:new-message": ["mod+n", "mod+shift+m"],
|
||||
"send": "mod+enter",
|
||||
"core:find-in-thread": "f4",
|
||||
"core:find-in-thread-next": "shift+f4",
|
||||
|
|
|
@ -80,7 +80,9 @@ class EventedIFrame extends React.Component
|
|||
doc = node.contentDocument
|
||||
return unless doc
|
||||
doc.removeEventListener('click', @_onIFrameClick)
|
||||
doc.removeEventListener('keydown', @_onIFrameKeydown)
|
||||
doc.removeEventListener('keydown', @_onIFrameKeyEvent)
|
||||
doc.removeEventListener('keypress', @_onIFrameKeyEvent)
|
||||
doc.removeEventListener('keyup', @_onIFrameKeyEvent)
|
||||
doc.removeEventListener('mousedown', @_onIFrameMouseEvent)
|
||||
doc.removeEventListener('mousemove', @_onIFrameMouseEvent)
|
||||
doc.removeEventListener('mouseup', @_onIFrameMouseEvent)
|
||||
|
@ -95,7 +97,9 @@ class EventedIFrame extends React.Component
|
|||
doc = node.contentDocument
|
||||
_.defer =>
|
||||
doc.addEventListener("click", @_onIFrameClick)
|
||||
doc.addEventListener("keydown", @_onIFrameKeydown)
|
||||
doc.addEventListener("keydown", @_onIFrameKeyEvent)
|
||||
doc.addEventListener("keypress", @_onIFrameKeyEvent)
|
||||
doc.addEventListener("keyup", @_onIFrameKeyEvent)
|
||||
doc.addEventListener("mousedown", @_onIFrameMouseEvent)
|
||||
doc.addEventListener("mousemove", @_onIFrameMouseEvent)
|
||||
doc.addEventListener("mouseup", @_onIFrameMouseEvent)
|
||||
|
@ -182,9 +186,16 @@ class EventedIFrame extends React.Component
|
|||
pageY: event.pageY + nodeRect.top
|
||||
})))
|
||||
|
||||
_onIFrameKeydown: (event) =>
|
||||
_onIFrameKeyEvent: (event) =>
|
||||
return if event.metaKey or event.altKey or event.ctrlKey
|
||||
ReactDOM.findDOMNode(@).dispatchEvent(new KeyboardEvent(event.type, event))
|
||||
|
||||
attrs = ['key', 'code','location', 'ctrlKey', 'shiftKey', 'altKey', 'metaKey', 'repeat', 'isComposing', 'charCode', 'keyCode', 'which']
|
||||
eventInit = Object.assign({bubbles: true}, _.pick(event, attrs))
|
||||
eventInParentDoc = new KeyboardEvent(event.type, eventInit)
|
||||
|
||||
Object.defineProperty(eventInParentDoc, 'which', {value: event.which})
|
||||
|
||||
ReactDOM.findDOMNode(@).dispatchEvent(eventInParentDoc)
|
||||
|
||||
_onIFrameContextualMenu: (event) =>
|
||||
# Build a standard-looking contextual menu with options like "Copy Link",
|
||||
|
|
|
@ -93,7 +93,7 @@ class KeymapManager
|
|||
forEachInKeymaps: (keymaps, cb) =>
|
||||
Object.keys(keymaps).forEach (command) =>
|
||||
keystrokesArray = keymaps[command]
|
||||
keystrokesArray = [keystrokesArray] unless keystrokes instanceof Array
|
||||
keystrokesArray = [keystrokesArray] unless keystrokesArray instanceof Array
|
||||
for keystrokes in keystrokesArray
|
||||
cb(command, keystrokes)
|
||||
|
||||
|
|
Loading…
Reference in a new issue