0
0
Fork 0

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(); firstInputElement.focus();
} }
const that = this; const that = this;
for (const availableInput of availableInputs) { this.$el.addEventListener('keyup', function (evt) {
availableInput.addEventListener('keydown', (evt) => { if (evt.key === 'Enter') {
if (evt.key === 'Enter') { const input = evt.target;
const input = evt.target; console.log('input', input);
console.log('input', input); if (input.type == 'textarea' && evt.shiftKey) {
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(); 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); editor.value.rotate(-90);
}; };
const onUploadAccept = () => { const onSubmit = () => {
try { try {
if (!newPhoto.files && !newPhoto.url) { if (!newPhoto.files && !newPhoto.url) {
notify(t('Select an image'), 'negative'); notify(t('Select an image'), 'negative');
@ -206,11 +206,7 @@ const makeRequest = async () => {
@on-fetch="(data) => (allowedContentTypes = data.join(', '))" @on-fetch="(data) => (allowedContentTypes = data.join(', '))"
auto-load auto-load
/> />
<QForm <QForm @submit="onSubmit()" class="all-pointer-events">
@submit="onUploadAccept()"
@keyup.enter="onUploadAccept()"
class="all-pointer-events"
>
<QCard class="q-pa-lg"> <QCard class="q-pa-lg">
<span ref="closeButton" class="close-icon" v-close-popup> <span ref="closeButton" class="close-icon" v-close-popup>
<QIcon name="close" size="sm" /> <QIcon name="close" size="sm" />