mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 04:59:21 +03:00
Small fixes
This commit is contained in:
parent
a72b95a868
commit
709eeddd09
9 changed files with 172 additions and 143 deletions
|
|
@ -5,6 +5,7 @@ import ko from 'ko';
|
|||
import hasher from 'hasher';
|
||||
import crossroads from 'crossroads';
|
||||
|
||||
import {Magics} from 'Common/Enums';
|
||||
import {runHook} from 'Common/Plugins';
|
||||
import {$html, VIEW_MODELS, popupVisibilityNames} from 'Common/Globals';
|
||||
|
||||
|
|
@ -590,8 +591,41 @@ function commandDecorator(canExecute = true)
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {miced} $items
|
||||
* @returns {Function}
|
||||
*/
|
||||
function settingsMenuKeysHendler($items)
|
||||
{
|
||||
return _.throttle((event, handler) => {
|
||||
|
||||
const up = handler && 'up' === handler.shortcut;
|
||||
|
||||
if (event && $items.length)
|
||||
{
|
||||
let index = $items.index($items.filter('.selected'));
|
||||
if (up && 0 < index)
|
||||
{
|
||||
index -= 1;
|
||||
}
|
||||
else if (!up && index < $items.length - 1)
|
||||
{
|
||||
index += 1;
|
||||
}
|
||||
|
||||
const resultHash = $items.eq(index).attr('href');
|
||||
if (resultHash)
|
||||
{
|
||||
setHash(resultHash, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
}, Magics.Time200ms);
|
||||
}
|
||||
|
||||
export {
|
||||
commandDecorator, commandDecorator as command,
|
||||
viewDecorator, viewDecorator as view, viewDecorator as viewModel,
|
||||
popupDecorator, popupDecorator as popup
|
||||
popupDecorator, popupDecorator as popup,
|
||||
settingsMenuKeysHendler
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue