1
0

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

(cherry picked from commit acc7c9f8f5442e5008bfd86b1615a72f6f763ee8)
This commit is contained in:
kolaente 2024-09-18 13:36:56 +02:00
parent a46009dfc9
commit 20c52a8325
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B

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)
}