-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove keyboard user setting and enable it always
- Loading branch information
1 parent
4dca002
commit 82369c0
Showing
3 changed files
with
18 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 9 additions & 15 deletions
24
components/pages/posts/navigation/page/KeyboardNavigationMixin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,31 @@ | ||
import { mapGetters } from 'vuex' | ||
|
||
export default { | ||
computed: { | ||
...mapGetters('user', ['getUserSettings']), | ||
}, | ||
|
||
methods: { | ||
keyboardPageHandler() { | ||
async keyboardPageHandler() { | ||
switch (event.keyCode) { | ||
case 39: | ||
this.getNextPage() | ||
console.debug('Loading next page via keyboard action.') | ||
|
||
await this.getNextPage() | ||
|
||
console.debug('Loading next page') | ||
break | ||
|
||
case 37: | ||
this.getPrevPage() | ||
console.debug('Loading previous page via keyboard action.') | ||
|
||
await this.getPrevPage() | ||
|
||
console.debug('Loading prev page') | ||
break | ||
} | ||
}, | ||
}, | ||
|
||
mounted() { | ||
// Navigation with keyboard | ||
if (this.getUserSettings.keyboardControls.value) | ||
document.addEventListener('keyup', this.keyboardPageHandler) | ||
document.addEventListener('keyup', this.keyboardPageHandler) | ||
}, | ||
|
||
destroyed() { | ||
// Navigation with keyboard | ||
if (this.getUserSettings.keyboardControls.value) | ||
document.removeEventListener('keyup', this.keyboardPageHandler) | ||
document.removeEventListener('keyup', this.keyboardPageHandler) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters