From d8bf95008a20c791714ac6e3beea18d8aefa5132 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 31 May 2024 13:33:03 +0200 Subject: [PATCH] fix: src/components/EditPictureForm.vue --- src/boot/qformMixin.js | 34 ++++++++++++++---------------- src/components/EditPictureForm.vue | 8 ++----- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/src/boot/qformMixin.js b/src/boot/qformMixin.js index 03476207b..a809140b0 100644 --- a/src/boot/qformMixin.js +++ b/src/boot/qformMixin.js @@ -24,26 +24,24 @@ export default { firstInputElement.focus(); } const that = this; - for (const availableInput of availableInputs) { - availableInput.addEventListener('keydown', (evt) => { - if (evt.key === 'Enter') { - const input = evt.target; - console.log('input', input); - 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; - } + this.$el.addEventListener('keyup', function (evt) { + if (evt.key === 'Enter') { + const input = evt.target; + console.log('input', input); + if (input.type == 'textarea' && evt.shiftKey) { evt.preventDefault(); - that.onSubmit(); + 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/components/EditPictureForm.vue b/src/components/EditPictureForm.vue index 4adfa37ea..8a22debda 100644 --- a/src/components/EditPictureForm.vue +++ b/src/components/EditPictureForm.vue @@ -155,7 +155,7 @@ const rotateRight = () => { editor.value.rotate(-90); }; -const onUploadAccept = () => { +const onSubmit = () => { try { if (!newPhoto.files && !newPhoto.url) { notify(t('Select an image'), 'negative'); @@ -206,11 +206,7 @@ const makeRequest = async () => { @on-fetch="(data) => (allowedContentTypes = data.join(', '))" auto-load /> - +