diff --git a/frontend/src/components/input/editor/TipTap.vue b/frontend/src/components/input/editor/TipTap.vue index d5ef4e181..7e801ce5e 100644 --- a/frontend/src/components/input/editor/TipTap.vue +++ b/frontend/src/components/input/editor/TipTap.vue @@ -314,7 +314,17 @@ const internalMode = ref('preview') const isEditing = computed(() => internalMode.value === 'edit' && isEditEnabled) const contentHasChanged = ref(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) }