Bugfix: messages list ArrowUp/ArrowDown broken

This commit is contained in:
djmaze 2021-02-12 12:00:06 +01:00
parent c47ed18db9
commit a2727c65fe
4 changed files with 18 additions and 37 deletions

View file

@ -28,9 +28,10 @@ module.exports = {
'SquireUI': "readonly",
// node_modules/knockout but dev/External/ko.js is used
'ko': "readonly",
// dev/External/ifvisible.js
'ifvisible': "readonly",
// vendors/routes/
'hasher': "readonly",
'signals': "readonly",
'Crossroads': "readonly",
// vendors/jua
'Jua': "readonly",

View file

@ -232,20 +232,6 @@ export class Selector {
}
}
/**
* @param {boolean} forceSelect
*/
goDown(forceSelect) {
this.newSelectPosition('ArrowDown', false, forceSelect);
}
/**
* @param {boolean} forceSelect
*/
goUp(forceSelect) {
this.newSelectPosition('ArrowUp', false, forceSelect);
}
unselect() {
this.selectedItem(null);
this.focusedItem(null);
@ -283,8 +269,7 @@ export class Selector {
return true;
});
shortcuts.add('arrowup', 'meta', keyScope, () => false);
shortcuts.add('arrowdown', 'meta', keyScope, () => false);
shortcuts.add('arrowup,arrowdown', 'meta', keyScope, () => false);
shortcuts.add('arrowup,arrowdown', 'shift', keyScope, event => {
this.newSelectPosition(event.key, true);
@ -329,7 +314,7 @@ export class Selector {
result = null;
const pageStep = 10,
list = this.list,
list = this.list(),
listLen = list.length,
focused = this.focusedItem();
@ -342,9 +327,7 @@ export class Selector {
} else if (++i < listLen) {
result = list[i];
}
if (!result && ' ' !== sEventKey) {
(this.oCallbacks.onUpUpOrDownDown || (()=>true))('ArrowUp' === sEventKey);
}
result || (this.oCallbacks.onUpUpOrDownDown || (()=>true))('ArrowUp' === sEventKey);
} else if ('Home' === sEventKey) {
result = list[0];
} else if ('End' === sEventKey) {
@ -361,13 +344,11 @@ export class Selector {
}
}
} else if (
'ArrowUp' == sEventKey ||
'Home' == sEventKey ||
'PageUp' == sEventKey
) {
result = list[0];
} else if (
'ArrowDown' === sEventKey ||
'End' === sEventKey ||
'PageDown' === sEventKey
) {
@ -392,9 +373,7 @@ export class Selector {
this.scrollToFocused();
} else if (focused) {
if (bShiftKey && isArrow) {
focused.checked(!focused.checked());
} else if (' ' === sEventKey) {
if ((bShiftKey && isArrow) || ' ' === sEventKey) {
focused.checked(!focused.checked());
}

View file

@ -1,5 +1,7 @@
(doc => {
let visible = "visible",
status = visible,
timer = 0,
wakeUp = () => {
clearTimeout(timer);
if (status !== visible) {
@ -12,8 +14,6 @@
}
}, 10000);
},
status = visible,
timer = 0,
init = () => {
init = ()=>{};
// Safari

View file

@ -49,10 +49,9 @@ import { ComposePopupView } from 'View/Popup/Compose';
import { AdvancedSearchPopupView } from 'View/Popup/AdvancedSearch';
const
canBeMovedHelper = () => MessageStore.hasCheckedOrSelected(),
ifvisible = window.ifvisible;
canBeMovedHelper = () => MessageStore.hasCheckedOrSelected();
class MessageListMailBoxUserView extends AbstractViewRight {
export class MessageListMailBoxUserView extends AbstractViewRight {
constructor() {
super('User/MailBox/MessageList', 'MailMessageList');
@ -211,9 +210,13 @@ class MessageListMailBoxUserView extends AbstractViewRight {
this.selector.on('onUpUpOrDownDown', v => this.goToUpUpOrDownDown(v));
addEventListener('mailbox.message-list.selector.go-down', e => this.selector.goDown(e.detail));
addEventListener('mailbox.message-list.selector.go-down',
e => this.selector.newSelectPosition('ArrowDown', false, e.detail)
);
addEventListener('mailbox.message-list.selector.go-up', e => this.selector.goUp(e.detail));
addEventListener('mailbox.message-list.selector.go-up',
e => this.selector.newSelectPosition('ArrowUp', false, e.detail)
);
addEventListener('mailbox.message.show', e => {
const sFolder = e.detail.Folder, sUid = e.detail.Uid;
@ -703,7 +706,7 @@ class MessageListMailBoxUserView extends AbstractViewRight {
this.initUploaderForAppend();
this.initShortcuts();
if (ifvisible && !rl.settings.app('mobile') && Settings.capa(Capa.Prefetch)) {
if (!rl.settings.app('mobile') && Settings.capa(Capa.Prefetch)) {
ifvisible.idle(this.prefetchNextTick.bind(this));
}
}
@ -854,7 +857,7 @@ class MessageListMailBoxUserView extends AbstractViewRight {
}
prefetchNextTick() {
if (ifvisible && !this.bPrefetch && !ifvisible.now() && this.viewModelVisible) {
if (!this.bPrefetch && !ifvisible.now() && this.viewModelVisible) {
const message = this.messageList.find(
item => item && !hasRequestedMessage(item.folder, item.uid)
);
@ -928,5 +931,3 @@ class MessageListMailBoxUserView extends AbstractViewRight {
return !!oJua;
}
}
export { MessageListMailBoxUserView };