Работа над хоткеями

This commit is contained in:
Book Pauk
2020-03-18 20:20:06 +07:00
parent 00a8e4c2c5
commit 22e2c34da8
3 changed files with 17 additions and 14 deletions

View File

@@ -173,21 +173,21 @@ class LoaderPage extends Vue {
const input = this.$refs.input.$refs.input; const input = this.$refs.input.$refs.input;
if (document.activeElement === input && event.type == 'keydown' && event.code == 'Enter') { if (document.activeElement === input && event.type == 'keydown' && event.code == 'Enter') {
this.submitUrl(); this.submitUrl();
}
if (event.type == 'keydown' && (event.code == 'F1' || (document.activeElement !== input && event.code == 'KeyH'))) {
this.$emit('help-toggle');
event.preventDefault();
event.stopPropagation();
return true; return true;
} }
if (event.type == 'keydown' && (document.activeElement !== input && event.code == 'KeyQ')) { if (event.type == 'keydown' && document.activeElement !== input) {
this.$emit('tool-bar-toggle'); const action = this.$root.readerActionByKeyEvent(event);
event.preventDefault(); switch (action) {
event.stopPropagation(); case 'help':
return true; this.$emit('help-toggle');
event.preventDefault();
event.stopPropagation();
return true;
}
} }
return false;
} }
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -58,8 +58,11 @@ class SetPositionPage extends Vue {
} }
keyHook(event) { keyHook(event) {
if (event.type == 'keydown' && (event.code == 'Escape' || event.code == 'KeyP')) { if (event.type == 'keydown') {
this.close(); const action = this.$root.readerActionByKeyEvent(event);
if (event.code == 'Escape' || action == 'setPosition') {
this.close();
}
} }
return true; return true;
} }