From bc22d61a3adc22dd1d47814e378a2d60217a7e18 Mon Sep 17 00:00:00 2001 From: vorotamoroz Date: Sun, 5 Apr 2026 17:43:29 +0900 Subject: [PATCH] Fixed: Now error messages are kept hidden if the show status inside the editor is disabled. --- src/lib | 2 +- src/modules/features/ModuleLog.ts | 51 ++++++++++++------- .../features/SettingDialogue/PaneGeneral.ts | 3 ++ 3 files changed, 36 insertions(+), 20 deletions(-) diff --git a/src/lib b/src/lib index d802c84..37b8e28 160000 --- a/src/lib +++ b/src/lib @@ -1 +1 @@ -Subproject commit d802c84a34d16102cf2470568b16241dc346b733 +Subproject commit 37b8e2813edbd09611d340e4810a0e31fa537521 diff --git a/src/modules/features/ModuleLog.ts b/src/modules/features/ModuleLog.ts index 467de2b..16de2d9 100644 --- a/src/modules/features/ModuleLog.ts +++ b/src/modules/features/ModuleLog.ts @@ -277,27 +277,36 @@ export class ModuleLog extends AbstractObsidianModule { } async updateMessageArea() { - if (this.messageArea) { - const messageLines = []; - const fileStatus = this.activeFileStatus.value; - if (fileStatus && !this.settings.hideFileWarningNotice) messageLines.push(fileStatus); - const messages = (await this.services.appLifecycle.getUnresolvedMessages()).flat().filter((e) => e); - const stringMessages = messages.filter((m): m is string => typeof m === "string"); // for 'startsWith' - const networkMessages = stringMessages.filter((m) => m.startsWith(MARK_LOG_NETWORK_ERROR)); - const otherMessages = stringMessages.filter((m) => !m.startsWith(MARK_LOG_NETWORK_ERROR)); + if (!this.messageArea) return; - messageLines.push(...otherMessages); - - if ( - this.settings.networkWarningStyle !== NetworkWarningStyles.ICON && - this.settings.networkWarningStyle !== NetworkWarningStyles.HIDDEN - ) { - messageLines.push(...networkMessages); - } else if (this.settings.networkWarningStyle === NetworkWarningStyles.ICON) { - if (networkMessages.length > 0) messageLines.push("🔗❌"); - } - this.messageArea.innerText = messageLines.map((e) => `⚠️ ${e}`).join("\n"); + const showStatusOnEditor = this.settings?.showStatusOnEditor ?? false; + if (this.statusDiv) { + this.statusDiv.style.display = showStatusOnEditor ? "" : "none"; } + if (!showStatusOnEditor) { + this.messageArea.innerText = ""; + return; + } + + const messageLines = []; + const fileStatus = this.activeFileStatus.value; + if (fileStatus && !this.settings.hideFileWarningNotice) messageLines.push(fileStatus); + const messages = (await this.services.appLifecycle.getUnresolvedMessages()).flat().filter((e) => e); + const stringMessages = messages.filter((m): m is string => typeof m === "string"); // for 'startsWith' + const networkMessages = stringMessages.filter((m) => m.startsWith(MARK_LOG_NETWORK_ERROR)); + const otherMessages = stringMessages.filter((m) => !m.startsWith(MARK_LOG_NETWORK_ERROR)); + + messageLines.push(...otherMessages); + + if ( + this.settings.networkWarningStyle !== NetworkWarningStyles.ICON && + this.settings.networkWarningStyle !== NetworkWarningStyles.HIDDEN + ) { + messageLines.push(...networkMessages); + } else if (this.settings.networkWarningStyle === NetworkWarningStyles.ICON) { + if (networkMessages.length > 0) messageLines.push("🔗❌"); + } + this.messageArea.innerText = messageLines.map((e) => `⚠️ ${e}`).join("\n"); } onActiveLeafChange() { @@ -326,6 +335,9 @@ export class ModuleLog extends AbstractObsidianModule { } this.statusBar?.setText(newMsg.split("\n")[0]); + if (this.statusDiv) { + this.statusDiv.style.display = this.settings?.showStatusOnEditor ? "" : "none"; + } if (this.settings?.showStatusOnEditor && this.statusDiv) { if (this.settings.showLongerLogInsideEditor) { const now = new Date().getTime(); @@ -402,6 +414,7 @@ export class ModuleLog extends AbstractObsidianModule { this.messageArea = this.statusDiv.createDiv({ cls: "livesync-status-messagearea" }); this.logMessage = this.statusDiv.createDiv({ cls: "livesync-status-logmessage" }); this.logHistory = this.statusDiv.createDiv({ cls: "livesync-status-loghistory" }); + this.statusDiv.style.display = this.settings?.showStatusOnEditor ? "" : "none"; eventHub.onEvent(EVENT_LAYOUT_READY, () => this.adjustStatusDivPosition()); if (this.settings?.showStatusOnStatusbar) { this.statusBar = this.services.API.addStatusBarItem(); diff --git a/src/modules/features/SettingDialogue/PaneGeneral.ts b/src/modules/features/SettingDialogue/PaneGeneral.ts index 213d27a..fc9cf33 100644 --- a/src/modules/features/SettingDialogue/PaneGeneral.ts +++ b/src/modules/features/SettingDialogue/PaneGeneral.ts @@ -21,6 +21,9 @@ export function paneGeneral( }); this.addOnSaved("displayLanguage", () => this.display()); new Setting(paneEl).autoWireToggle("showStatusOnEditor"); + this.addOnSaved("showStatusOnEditor", () => { + eventHub.emitEvent(EVENT_ON_UNRESOLVED_ERROR); + }); new Setting(paneEl).autoWireToggle("showOnlyIconsOnEditor", { onUpdate: visibleOnly(() => this.isConfiguredAs("showStatusOnEditor", true)), });