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:
parent
a46009dfc9
commit
20c52a8325
@ -314,7 +314,17 @@ const internalMode = ref<Mode>('preview')
|
|||||||
const isEditing = computed(() => internalMode.value === 'edit' && isEditEnabled)
|
const isEditing = computed(() => internalMode.value === 'edit' && isEditEnabled)
|
||||||
const contentHasChanged = ref<boolean>(false)
|
const contentHasChanged = ref<boolean>(false)
|
||||||
|
|
||||||
let lastSavedState = modelValue
|
let lastSavedState = ''
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => modelValue,
|
||||||
|
(newValue) => {
|
||||||
|
if (!contentHasChanged.value) {
|
||||||
|
lastSavedState = newValue
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true },
|
||||||
|
)
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => internalMode.value,
|
() => internalMode.value,
|
||||||
@ -576,6 +586,8 @@ function setLink(event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
console.log('Component has mounted')
|
||||||
|
|
||||||
if (editShortcut !== '') {
|
if (editShortcut !== '') {
|
||||||
document.addEventListener('keydown', setFocusToEditor)
|
document.addEventListener('keydown', setFocusToEditor)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user