mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-05 04:15:35 -04:00
Allow keyboard navigation on reader page (#124)
This commit is contained in:
parent
7792d3426e
commit
011123f690
@ -292,3 +292,19 @@ const flipPage = (isNext) => {
|
|||||||
replaceHistory(newIdx);
|
replaceHistory(newIdx);
|
||||||
saveProgress(newIdx);
|
saveProgress(newIdx);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the global keydown events
|
||||||
|
*
|
||||||
|
* @function keyHandler
|
||||||
|
* @param {event} event - The $event object
|
||||||
|
*/
|
||||||
|
const keyHandler = (event) => {
|
||||||
|
const mode = getProp('mode');
|
||||||
|
if (mode === 'continuous') return;
|
||||||
|
|
||||||
|
if (event.key === 'ArrowLeft' || event.key === 'j')
|
||||||
|
flipPage(false);
|
||||||
|
if (event.key === 'ArrowRight' || event.key === 'k')
|
||||||
|
flipPage(true);
|
||||||
|
};
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
flipAnimation: null
|
flipAnimation: null
|
||||||
}">
|
}">
|
||||||
|
|
||||||
|
<div @keydown.window.debounce="keyHandler($event)"></div>
|
||||||
|
|
||||||
<div class="uk-container uk-container-small">
|
<div class="uk-container uk-container-small">
|
||||||
<div id="alert"></div>
|
<div id="alert"></div>
|
||||||
<div x-show="loading">
|
<div x-show="loading">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user