fix(editor): restore the current value, not the one from a previous task

Resolves https://community.vikunja.io/t/task-description-is-overwritten-when-pressing-esc-key/2813
This commit is contained in:
kolaente 2024-09-18 13:36:56 +02:00
parent cc64ca6406
commit acc7c9f8f5
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B
1 changed files with 13 additions and 1 deletions

View File

@ -314,7 +314,17 @@ const internalMode = ref<Mode>('preview')
const isEditing = computed(() => internalMode.value === 'edit' && isEditEnabled)
const contentHasChanged = ref<boolean>(false)
let lastSavedState = modelValue
let lastSavedState = ''
watch(
() => modelValue,
(newValue) => {
if (!contentHasChanged.value) {
lastSavedState = newValue
}
},
{ immediate: true },
)
watch(
() => internalMode.value,
@ -576,6 +586,8 @@ function setLink(event) {
}
onMounted(async () => {
console.log('Component has mounted')
if (editShortcut !== '') {
document.addEventListener('keydown', setFocusToEditor)
}