mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-10-18 07:12:32 +00:00
Add connection warning style logic and settings UI dropdown
This commit is contained in:
@@ -281,7 +281,11 @@ export class ModuleLog extends AbstractObsidianModule {
|
|||||||
const fileStatus = this.activeFileStatus.value;
|
const fileStatus = this.activeFileStatus.value;
|
||||||
if (fileStatus && !this.settings.hideFileWarningNotice) messageLines.push(fileStatus);
|
if (fileStatus && !this.settings.hideFileWarningNotice) messageLines.push(fileStatus);
|
||||||
const messages = (await this.services.appLifecycle.getUnresolvedMessages()).flat().filter((e) => e);
|
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");
|
this.messageArea.innerText = messageLines.map((e) => `⚠️ ${e}`).join("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { LiveSyncSetting as Setting } from "./LiveSyncSetting.ts";
|
|||||||
import type { ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab.ts";
|
import type { ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab.ts";
|
||||||
import type { PageFunctions } from "./SettingPane.ts";
|
import type { PageFunctions } from "./SettingPane.ts";
|
||||||
import { visibleOnly } from "./SettingPane.ts";
|
import { visibleOnly } from "./SettingPane.ts";
|
||||||
|
import { EVENT_ON_UNRESOLVED_ERROR, eventHub } from "@/common/events.ts";
|
||||||
export function paneGeneral(
|
export function paneGeneral(
|
||||||
this: ObsidianLiveSyncSettingTab,
|
this: ObsidianLiveSyncSettingTab,
|
||||||
paneEl: HTMLElement,
|
paneEl: HTMLElement,
|
||||||
@@ -24,6 +25,16 @@ export function paneGeneral(
|
|||||||
});
|
});
|
||||||
new Setting(paneEl).autoWireToggle("showStatusOnStatusbar");
|
new Setting(paneEl).autoWireToggle("showStatusOnStatusbar");
|
||||||
new Setting(paneEl).autoWireToggle("hideFileWarningNotice");
|
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) => {
|
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleLogging")).then((paneEl) => {
|
||||||
paneEl.addClass("wizardHidden");
|
paneEl.addClass("wizardHidden");
|
||||||
|
|||||||
Reference in New Issue
Block a user