From f4d8c0a8dbd81023708e41cbe1651e49e530882e Mon Sep 17 00:00:00 2001 From: A-wry Date: Fri, 20 Feb 2026 21:51:30 -0500 Subject: [PATCH] Add connection warning style logic and settings UI dropdown --- src/modules/features/ModuleLog.ts | 6 +++++- src/modules/features/SettingDialogue/PaneGeneral.ts | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/modules/features/ModuleLog.ts b/src/modules/features/ModuleLog.ts index f841256..b2689e2 100644 --- a/src/modules/features/ModuleLog.ts +++ b/src/modules/features/ModuleLog.ts @@ -281,7 +281,11 @@ export class ModuleLog extends AbstractObsidianModule { const fileStatus = this.activeFileStatus.value; if (fileStatus && !this.settings.hideFileWarningNotice) messageLines.push(fileStatus); const messages = (await this.services.appLifecycle.getUnresolvedMessages()).flat().filter((e) => e); - messageLines.push(...messages); + if (this.settings.connectionWarningStyle === "banner") { + messageLines.push(...messages); + } else if (this.settings.connectionWarningStyle === "icon") { + if (messages.length > 0) messageLines.push("🔗❌"); + } this.messageArea.innerText = messageLines.map((e) => `⚠️ ${e}`).join("\n"); } } diff --git a/src/modules/features/SettingDialogue/PaneGeneral.ts b/src/modules/features/SettingDialogue/PaneGeneral.ts index 0a92b7b..4568392 100644 --- a/src/modules/features/SettingDialogue/PaneGeneral.ts +++ b/src/modules/features/SettingDialogue/PaneGeneral.ts @@ -4,6 +4,7 @@ import { LiveSyncSetting as Setting } from "./LiveSyncSetting.ts"; import type { ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab.ts"; import type { PageFunctions } from "./SettingPane.ts"; import { visibleOnly } from "./SettingPane.ts"; +import { EVENT_ON_UNRESOLVED_ERROR, eventHub } from "@/common/events.ts"; export function paneGeneral( this: ObsidianLiveSyncSettingTab, paneEl: HTMLElement, @@ -24,6 +25,16 @@ export function paneGeneral( }); new Setting(paneEl).autoWireToggle("showStatusOnStatusbar"); new Setting(paneEl).autoWireToggle("hideFileWarningNotice"); + new Setting(paneEl).autoWireDropDown("connectionWarningStyle", { + options: { + banner: "Show full banner", + icon: "Show icon only", + hidden: "Hide completely", + }, + }); + this.addOnSaved("connectionWarningStyle", () => { + eventHub.emitEvent(EVENT_ON_UNRESOLVED_ERROR); + }); }); void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleLogging")).then((paneEl) => { paneEl.addClass("wizardHidden");