fix: src/components/EditPictureForm.vue

This commit is contained in:
Javier Segarra 2024-05-31 13:33:03 +02:00
parent d5dc9d974c
commit d8bf95008a
2 changed files with 18 additions and 24 deletions

View File

@ -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();
}
});
}
}
},

View File

@ -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
/>
<QForm
@submit="onUploadAccept()"
@keyup.enter="onUploadAccept()"
class="all-pointer-events"
>
<QForm @submit="onSubmit()" class="all-pointer-events">
<QCard class="q-pa-lg">
<span ref="closeButton" class="close-icon" v-close-popup>
<QIcon name="close" size="sm" />