From c8fbef1754e54ba13d69d16f96bad569961b39d8 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 14 Aug 2024 10:01:55 +0200 Subject: [PATCH] feat: split mixins --- src/boot/qformMixin.js | 30 ------------------------------ src/boot/quasar.js | 6 ++++-- 2 files changed, 4 insertions(+), 32 deletions(-) delete mode 100644 src/boot/qformMixin.js diff --git a/src/boot/qformMixin.js b/src/boot/qformMixin.js deleted file mode 100644 index fc7852369..000000000 --- a/src/boot/qformMixin.js +++ /dev/null @@ -1,30 +0,0 @@ -import { getCurrentInstance } from 'vue'; - -export default { - mounted: function () { - const vm = getCurrentInstance(); - if (vm.type.name === 'QForm') { - if (!['searchbarForm', 'filterPanelForm'].includes(this.$el?.id)) { - // TODO: AUTOFOCUS IS NOT FOCUSING - const that = this; - this.$el.addEventListener('keyup', function (evt) { - if (evt.key === 'Enter') { - const input = evt.target; - if (input.type == 'textarea' && evt.shiftKey) { - evt.preventDefault(); - let { selectionStart, selectionEnd } = input; - input.value = - input.value.substring(0, selectionStart) + - '\n' + - input.value.substring(selectionEnd); - selectionStart = selectionEnd = selectionStart + 1; - return; - } - evt.preventDefault(); - that.onSubmit(); - } - }); - } - } - }, -}; diff --git a/src/boot/quasar.js b/src/boot/quasar.js index a8d9b7ad9..19f4bdffd 100644 --- a/src/boot/quasar.js +++ b/src/boot/quasar.js @@ -1,6 +1,8 @@ import { boot } from 'quasar/wrappers'; -import qFormMixin from './qformMixin'; +import qformEnterEvent from './qformEnterEvent'; +import qformFocus from './qformFocus'; export default boot(({ app }) => { - app.mixin(qFormMixin); + app.mixin(qformEnterEvent); + app.mixin(qformFocus); });