🐛 Fix bugs in timetable editor

- Turn off autocorrect / spellcheck
- Prevent some browsers from jumping to the start of the text field
- Correctly handle lesson lengths
This commit is contained in:
2023-06-19 16:14:10 +02:00
parent 67ac435331
commit 9afae9b2cc
3 changed files with 32 additions and 7 deletions

View File

@ -47,6 +47,9 @@ function arrayMove(arr, fromIndex, toIndex) {
arr.splice(fromIndex, 1);
arr.splice(toIndex, 0, element);
}
// Increment this variable to rerender all lesson lists
const forceUpdate = ref(0);
</script>
<template>
@ -70,7 +73,7 @@ function arrayMove(arr, fromIndex, toIndex) {
>
<swiper-slide :key="day" v-for="day in 5">
<ScrollableContainer>
<div class="list">
<div class="list" :key="forceUpdate">
<div
class="lesson"
v-for="(lesson, index) in timetableClone.data[day - 1]"
@ -82,7 +85,12 @@ function arrayMove(arr, fromIndex, toIndex) {
:lesson="lesson"
:edit="true"
@change="(e) => (timetableClone.data[day - 1][index] = e)"
@delete="timetableClone.data[day - 1].splice(index, 1)"
@delete="
() => {
timetableClone.data[day - 1].splice(index, 1);
forceUpdate++;
}
"
@move="
(direction) => {
if (direction == 'up' && index > 0) {
@ -101,6 +109,7 @@ function arrayMove(arr, fromIndex, toIndex) {
index + 1
);
}
forceUpdate++;
}
"
/>