diff --git a/src/components/StackedNote.vue b/src/components/StackedNote.vue index dd1864c..c3a256d 100644 --- a/src/components/StackedNote.vue +++ b/src/components/StackedNote.vue @@ -239,6 +239,25 @@ const onConflictOverwrite = async () => { const onConflictCancel = () => { if (mode.value === "read") toggleMode() } + +const onBadgeClick = async () => { + if (freshnessStatus.value !== "outdated") { + await checkFreshness() + return + } + + const hasUnsavedEdits = rawContent.value !== initialRawContent.value + if (hasUnsavedEdits) { + conflictOpen.value = true + return + } + + const newRaw = await pullLatest() + if (newRaw !== null) { + rawContent.value = newRaw + initialRawContent.value = newRaw + } +}