From 5411a667eb43c538be52f7a75ce6f6b17613e343 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 23 Oct 2024 14:03:42 +0200 Subject: [PATCH] fix(shortcutMixin): refs #8010 not mixin --- src/boot/mainShortcutMixin.js | 38 ----------------------------------- src/boot/quasar.js | 2 -- src/layouts/MainLayout.vue | 37 ++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 40 deletions(-) delete mode 100644 src/boot/mainShortcutMixin.js diff --git a/src/boot/mainShortcutMixin.js b/src/boot/mainShortcutMixin.js deleted file mode 100644 index 8e5f147db..000000000 --- a/src/boot/mainShortcutMixin.js +++ /dev/null @@ -1,38 +0,0 @@ -import routes from 'src/router/modules'; -import { useRouter } from 'vue-router'; - -let isNotified = false; - -export default { - created: function () { - const router = useRouter(); - const keyBindingMap = routes - .filter((route) => route.meta.keyBinding) - .reduce((map, route) => { - map['Key' + route.meta.keyBinding.toUpperCase()] = route.path; - return map; - }, {}); - - const handleKeyDown = (event) => { - const { ctrlKey, altKey, code } = event; - - if (ctrlKey && altKey && keyBindingMap[code] && !isNotified) { - event.preventDefault(); - router.push(keyBindingMap[code]); - isNotified = true; - } - }; - - const handleKeyUp = (event) => { - const { ctrlKey, altKey } = event; - - // Resetea la bandera cuando se sueltan las teclas ctrl o alt - if (!ctrlKey || !altKey) { - isNotified = false; - } - }; - - window.addEventListener('keydown', handleKeyDown); - window.addEventListener('keyup', handleKeyUp); - }, -}; diff --git a/src/boot/quasar.js b/src/boot/quasar.js index 5db6edd24..f39d1f0be 100644 --- a/src/boot/quasar.js +++ b/src/boot/quasar.js @@ -1,13 +1,11 @@ import { boot } from 'quasar/wrappers'; import qFormMixin from './qformMixin'; -import mainShortcutMixin from './mainShortcutMixin'; import keyShortcut from './keyShortcut'; import useNotify from 'src/composables/useNotify.js'; const { notify } = useNotify(); export default boot(({ app }) => { app.mixin(qFormMixin); - app.mixin(mainShortcutMixin); app.directive('shortcut', keyShortcut); app.config.errorHandler = function (err) { console.error(err); diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 51cd20071..754b084fc 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -1,7 +1,44 @@