mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 00:17:03 +03:00
Bugfix: '`' backtick shortcut being dead key
* remove 'Insert' key from class Selector and bugfix Selector ' ' space. * replace 'M' (move) shortcut with 'Insert' (like: insert into) * '`' backtick being dead key shortcut with 'M' and 'ContextMenu' keys.
This commit is contained in:
parent
e0f5849de6
commit
4177467f81
8 changed files with 70 additions and 112 deletions
|
|
@ -24,16 +24,16 @@ class AbstractApp {
|
||||||
this.lastErrorTime = 0;
|
this.lastErrorTime = 0;
|
||||||
|
|
||||||
const $doc = document;
|
const $doc = document;
|
||||||
$doc.addEventListener('keydown', (event) => {
|
$doc.addEventListener('keydown', event =>
|
||||||
if (event && event.ctrlKey) {
|
event.ctrlKey && $htmlCL.add('rl-ctrl-key-pressed')
|
||||||
$htmlCL.add('rl-ctrl-key-pressed');
|
// $htmlCL.toggle('rl-ctrl-key-pressed', event.ctrlKey)
|
||||||
}
|
// 'Control' === event.key && $htmlCL.add('rl-ctrl-key-pressed')
|
||||||
});
|
);
|
||||||
$doc.addEventListener('keyup', (event) => {
|
$doc.addEventListener('keyup', event =>
|
||||||
if (event && !event.ctrlKey) {
|
// !event.ctrlKey && $htmlCL.remove('rl-ctrl-key-pressed')
|
||||||
$htmlCL.remove('rl-ctrl-key-pressed');
|
$htmlCL.toggle('rl-ctrl-key-pressed', event.ctrlKey)
|
||||||
}
|
// 'Control' === event.key && $htmlCL.remove('rl-ctrl-key-pressed')
|
||||||
});
|
);
|
||||||
|
|
||||||
const fn = (()=>dispatchEvent(new CustomEvent('rl.auto-logout-refresh'))).debounce(5000);
|
const fn = (()=>dispatchEvent(new CustomEvent('rl.auto-logout-refresh'))).debounce(5000);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ class Selector {
|
||||||
mSelected = null;
|
mSelected = null;
|
||||||
|
|
||||||
this.list.subscribe(
|
this.list.subscribe(
|
||||||
(items) => {
|
items => {
|
||||||
if (Array.isArray(items)) {
|
if (Array.isArray(items)) {
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
if (item) {
|
if (item) {
|
||||||
|
|
@ -290,7 +290,7 @@ class Selector {
|
||||||
this.newSelectPosition(event.key, true);
|
this.newSelectPosition(event.key, true);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
shortcuts.add('arrowup,arrowdown,home,end,pageup,pagedown,insert,space', '', keyScope, event => {
|
shortcuts.add('arrowup,arrowdown,home,end,pageup,pagedown,space', '', keyScope, event => {
|
||||||
this.newSelectPosition(event.key, false);
|
this.newSelectPosition(event.key, false);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
@ -325,9 +325,7 @@ class Selector {
|
||||||
* @param {boolean=} bForceSelect = false
|
* @param {boolean=} bForceSelect = false
|
||||||
*/
|
*/
|
||||||
newSelectPosition(sEventKey, bShiftKey, bForceSelect) {
|
newSelectPosition(sEventKey, bShiftKey, bForceSelect) {
|
||||||
let index = 0,
|
let isArrow = 'ArrowUp' === sEventKey || 'ArrowDown' === sEventKey,
|
||||||
isNext = false,
|
|
||||||
isStop = false,
|
|
||||||
result = null;
|
result = null;
|
||||||
|
|
||||||
const pageStep = 10,
|
const pageStep = 10,
|
||||||
|
|
@ -336,81 +334,44 @@ class Selector {
|
||||||
focused = this.focusedItem();
|
focused = this.focusedItem();
|
||||||
|
|
||||||
if (0 < listLen) {
|
if (0 < listLen) {
|
||||||
if (!focused) {
|
if (focused) {
|
||||||
if (
|
if (isArrow) {
|
||||||
'ArrowDown' == sEventKey ||
|
let i = list.indexOf(focused);
|
||||||
'Insert' == sEventKey ||
|
if ('ArrowUp' == sEventKey) {
|
||||||
' ' == sEventKey ||
|
i > 0 && (result = list[i-1]);
|
||||||
'Home' == sEventKey ||
|
} else if (++i < listLen) {
|
||||||
'PageUp' == sEventKey
|
result = list[i];
|
||||||
) {
|
}
|
||||||
result = list[0];
|
if (!result && ' ' !== sEventKey) {
|
||||||
} else if (
|
|
||||||
'ArrowUp' === sEventKey ||
|
|
||||||
'End' === sEventKey ||
|
|
||||||
'PageDown' === sEventKey
|
|
||||||
) {
|
|
||||||
result = list[list.length - 1];
|
|
||||||
}
|
|
||||||
} else if (focused) {
|
|
||||||
if (
|
|
||||||
'ArrowDown' === sEventKey ||
|
|
||||||
'ArrowUp' === sEventKey ||
|
|
||||||
'Insert' === sEventKey ||
|
|
||||||
' ' === sEventKey
|
|
||||||
) {
|
|
||||||
list.forEach(item => {
|
|
||||||
if (!isStop) {
|
|
||||||
switch (sEventKey) {
|
|
||||||
case 'ArrowUp':
|
|
||||||
if (focused === item) {
|
|
||||||
isStop = true;
|
|
||||||
} else {
|
|
||||||
result = item;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'ArrowDown':
|
|
||||||
case 'Insert':
|
|
||||||
if (isNext) {
|
|
||||||
result = item;
|
|
||||||
isStop = true;
|
|
||||||
} else if (focused === item) {
|
|
||||||
isNext = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
// no default
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!result && ('ArrowDown' === sEventKey || 'ArrowUp' === sEventKey)) {
|
|
||||||
(this.oCallbacks.onUpUpOrDownDown || (()=>true))('ArrowUp' === sEventKey);
|
(this.oCallbacks.onUpUpOrDownDown || (()=>true))('ArrowUp' === sEventKey);
|
||||||
}
|
}
|
||||||
} else if ('Home' === sEventKey || 'End' === sEventKey) {
|
} else if ('Home' === sEventKey) {
|
||||||
if ('Home' === sEventKey) {
|
result = list[0];
|
||||||
result = list[0];
|
} else if ('End' === sEventKey) {
|
||||||
} else if ('End' === sEventKey) {
|
result = list[list.length - 1];
|
||||||
result = list[list.length - 1];
|
|
||||||
}
|
|
||||||
} else if ('PageDown' === sEventKey) {
|
} else if ('PageDown' === sEventKey) {
|
||||||
for (; index < listLen; index++) {
|
let i = list.indexOf(focused);
|
||||||
if (focused === list[index]) {
|
if (i < listLen - 1) {
|
||||||
index += pageStep;
|
result = list[Math.min(i + pageStep, listLen - 1)];
|
||||||
index = listLen - 1 < index ? listLen - 1 : index;
|
|
||||||
result = list[index];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if ('PageUp' === sEventKey) {
|
} else if ('PageUp' === sEventKey) {
|
||||||
for (index = listLen; 0 <= index; index--) {
|
let i = list.indexOf(focused);
|
||||||
if (focused === list[index]) {
|
if (i > 0) {
|
||||||
index -= pageStep;
|
result = list[Math.max(0, i - pageStep)];
|
||||||
index = 0 > index ? 0 : index;
|
|
||||||
result = list[index];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (
|
||||||
|
'ArrowUp' == sEventKey ||
|
||||||
|
'Home' == sEventKey ||
|
||||||
|
'PageUp' == sEventKey
|
||||||
|
) {
|
||||||
|
result = list[0];
|
||||||
|
} else if (
|
||||||
|
'ArrowDown' === sEventKey ||
|
||||||
|
'End' === sEventKey ||
|
||||||
|
'PageDown' === sEventKey
|
||||||
|
) {
|
||||||
|
result = list[list.length - 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -418,11 +379,9 @@ class Selector {
|
||||||
this.focusedItem(result);
|
this.focusedItem(result);
|
||||||
|
|
||||||
if (focused) {
|
if (focused) {
|
||||||
if (bShiftKey) {
|
if (bShiftKey && isArrow) {
|
||||||
if ('ArrowUp' === sEventKey || 'ArrowDown' === sEventKey) {
|
focused.checked(!focused.checked());
|
||||||
focused.checked(!focused.checked());
|
} else if (' ' === sEventKey) {
|
||||||
}
|
|
||||||
} else if ('Insert' === sEventKey || ' ' === sEventKey) {
|
|
||||||
focused.checked(!focused.checked());
|
focused.checked(!focused.checked());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -433,9 +392,9 @@ class Selector {
|
||||||
|
|
||||||
this.scrollToFocused();
|
this.scrollToFocused();
|
||||||
} else if (focused) {
|
} else if (focused) {
|
||||||
if (bShiftKey && ('ArrowUp' === sEventKey || 'ArrowDown' === sEventKey)) {
|
if (bShiftKey && isArrow) {
|
||||||
focused.checked(!focused.checked());
|
focused.checked(!focused.checked());
|
||||||
} else if ('Insert' === sEventKey || ' ' === sEventKey) {
|
} else if (' ' === sEventKey) {
|
||||||
focused.checked(!focused.checked());
|
focused.checked(!focused.checked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
4
dev/External/ko.js
vendored
4
dev/External/ko.js
vendored
|
|
@ -59,7 +59,7 @@ ko.bindingHandlers.openDropdownTrigger = {
|
||||||
update: (element, fValueAccessor) => {
|
update: (element, fValueAccessor) => {
|
||||||
if (ko.unwrap(fValueAccessor())) {
|
if (ko.unwrap(fValueAccessor())) {
|
||||||
const el = element.ddBtn;
|
const el = element.ddBtn;
|
||||||
el.open || el.Dropdown.toggle();
|
el.open || el.toggle();
|
||||||
// el.focus();
|
// el.focus();
|
||||||
|
|
||||||
rl.Dropdowns.detectVisibility();
|
rl.Dropdowns.detectVisibility();
|
||||||
|
|
@ -70,7 +70,7 @@ ko.bindingHandlers.openDropdownTrigger = {
|
||||||
|
|
||||||
ko.bindingHandlers.dropdownCloser = {
|
ko.bindingHandlers.dropdownCloser = {
|
||||||
init: element => element.closest('.dropdown').addEventListener('click', event =>
|
init: element => element.closest('.dropdown').addEventListener('click', event =>
|
||||||
event.target.closestWithin('.e-item', element) && element.ddBtn.Dropdown.toggle()
|
event.target.closestWithin('.e-item', element) && element.ddBtn.toggle()
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1151,25 +1151,23 @@ class ComposePopupView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
popupMenu(event) {
|
||||||
|
if (event.ctrlKey || event.metaKey || 'ContextMenu' == event.key
|
||||||
|
|| (this.oEditor && !this.oEditor.hasFocus() && !inFocus())) {
|
||||||
|
this.identitiesDropdownTrigger(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
onBuild(dom) {
|
onBuild(dom) {
|
||||||
this.initUploader();
|
this.initUploader();
|
||||||
|
|
||||||
shortcuts.add('q', 'meta', KeyState.Compose, ()=>false);
|
shortcuts.add('q', 'meta', KeyState.Compose, ()=>false);
|
||||||
shortcuts.add('w', 'meta', KeyState.Compose, ()=>false);
|
shortcuts.add('w', 'meta', KeyState.Compose, ()=>false);
|
||||||
|
|
||||||
shortcuts.add('`', '', KeyState.Compose, () => {
|
shortcuts.add('m,contextmenu', '', KeyState.Compose, e => this.popupMenu(e));
|
||||||
if (this.oEditor && !this.oEditor.hasFocus() && !inFocus()) {
|
shortcuts.add('m', 'ctrl', KeyState.Compose, e => this.popupMenu(e));
|
||||||
this.identitiesDropdownTrigger(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
shortcuts.add('`', 'ctrl', KeyState.Compose, () => {
|
|
||||||
this.identitiesDropdownTrigger(true);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
shortcuts.add('escape,close', '', KeyState.Compose, () => {
|
shortcuts.add('escape,close', '', KeyState.Compose, () => {
|
||||||
this.skipCommand();
|
this.skipCommand();
|
||||||
|
|
|
||||||
|
|
@ -81,10 +81,11 @@ class AbstractSystemDropDownUserView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
|
|
||||||
onBuild() {
|
onBuild() {
|
||||||
shortcuts.add('`', '', [KeyState.MessageList, KeyState.MessageView, KeyState.Settings], () => {
|
shortcuts.add('m,contextmenu', '', [KeyState.MessageList, KeyState.MessageView, KeyState.Settings], () => {
|
||||||
if (this.viewModelVisible) {
|
if (this.viewModelVisible) {
|
||||||
MessageStore.messageFullScreenMode(false);
|
MessageStore.messageFullScreenMode(false);
|
||||||
this.accountMenuDropdownTrigger(true);
|
this.accountMenuDropdownTrigger(true);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -801,7 +801,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
||||||
|
|
||||||
if (Settings.capa(Capa.MessageListActions)) {
|
if (Settings.capa(Capa.MessageListActions)) {
|
||||||
// move
|
// move
|
||||||
shortcuts.add('m', '', KeyState.MessageList, () => {
|
shortcuts.add('insert', '', KeyState.MessageList, () => {
|
||||||
if (this.newMoveToFolder()) {
|
if (this.newMoveToFolder()) {
|
||||||
this.moveNewCommand();
|
this.moveNewCommand();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ const
|
||||||
toArray = v => Array.isArray(v) ? v : v.split(/\s*,\s*/),
|
toArray = v => Array.isArray(v) ? v : v.split(/\s*,\s*/),
|
||||||
|
|
||||||
keydown = event => {
|
keydown = event => {
|
||||||
let key = (event.key || event.code || '').toLowerCase(),
|
let key = (event.key || event.code || '').toLowerCase().replace(' ','space'),
|
||||||
scopes = [];
|
scopes = [];
|
||||||
scope[key] && scopes.push(scope[key]);
|
scope[key] && scopes.push(scope[key]);
|
||||||
_scope !== 'all' && _scopes.all[key] && scopes.push(_scopes.all[key]);
|
_scope !== 'all' && _scopes.all[key] && scopes.push(_scopes.all[key]);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
<table class="table table-striped table-bordered">
|
<table class="table table-striped table-bordered">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_OPEN_USER_DROPDOWN"></td><td>` (tilde)</td></tr>
|
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_OPEN_USER_DROPDOWN"></td><td>M, Menu</td></tr>
|
||||||
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_REPLY"></td><td>R, Reply</td></tr>
|
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_REPLY"></td><td>R, Reply</td></tr>
|
||||||
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_REPLY_ALL"></td><td>A, Shift + Reply</td></tr>
|
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_REPLY_ALL"></td><td>A, Shift + Reply</td></tr>
|
||||||
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_FORWARD"></td><td>F, Fwd</td></tr>
|
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_FORWARD"></td><td>F, Fwd</td></tr>
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_ARCHIVE"></td><td>Z</td></tr>
|
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_ARCHIVE"></td><td>Z</td></tr>
|
||||||
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_DELETE"></td><td>Delete, Shift + Delete, #</td></tr>
|
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_DELETE"></td><td>Delete, Shift + Delete, #</td></tr>
|
||||||
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_OPEN_THREAD"></td><td>T</td></tr>
|
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_OPEN_THREAD"></td><td>T</td></tr>
|
||||||
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_MOVE"></td><td>M</td></tr>
|
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_MOVE"></td><td>Insert</td></tr>
|
||||||
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_READ"></td><td>Q</td></tr>
|
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_READ"></td><td>Q</td></tr>
|
||||||
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_UNREAD"></td><td>U</td></tr>
|
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_UNREAD"></td><td>U</td></tr>
|
||||||
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_IMPORTANT"></td><td>I</td></tr>
|
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_IMPORTANT"></td><td>I</td></tr>
|
||||||
|
|
@ -74,9 +74,9 @@
|
||||||
<table class="table table-striped table-bordered">
|
<table class="table table-striped table-bordered">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_OPEN_COMPOSE_POPUP"></td><td>W, C, New</td></tr>
|
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_OPEN_COMPOSE_POPUP"></td><td>W, C, New</td></tr>
|
||||||
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_OPEN_IDENTITIES_DROPDOWN"></td><td>` (tilde), Ctrl + `, ⌘ + `</td></tr>
|
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_OPEN_IDENTITIES_DROPDOWN"></td><td>M, Menu, Ctrl + M, ⌘ + M</td></tr>
|
||||||
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_SAVE_MESSAGE"></td><td>Ctrl + S, ⌘ + S, Save</td></tr>
|
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_SAVE_MESSAGE"></td><td>Ctrl + S, ⌘ + S, Save</td></tr>
|
||||||
<!--<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_SEND_MESSAGE"></td><td>Ctrl + Enter, ⌘ + Enter</td></tr>-->
|
<!--<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_SEND_MESSAGE"></td><td>Send, Ctrl + Enter, ⌘ + Enter</td></tr>-->
|
||||||
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_MINIMIZE_COMPOSE_POPUP"></td><td>Esc, Close</td></tr>
|
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_MINIMIZE_COMPOSE_POPUP"></td><td>Esc, Close</td></tr>
|
||||||
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_CLOSE_COMPOSE"></td><td>Shift + Esc, Shift + Close</td></tr>
|
<tr><td class="i18n" data-i18n="SHORTCUTS_HELP/LABEL_CLOSE_COMPOSE"></td><td>Shift + Esc, Shift + Close</td></tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue