Add connection warning style logic and settings UI dropdown

This commit is contained in:
A-wry
2026-02-20 21:51:30 -05:00
parent b1bba7685e
commit f4d8c0a8db
2 changed files with 16 additions and 1 deletions

View File

@@ -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");
}
}

View File

@@ -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");