Merge remote-tracking branch 'origin/main' into beta to port #802

This commit is contained in:
vorotamoroz
2026-02-24 07:44:18 +00:00
5 changed files with 32 additions and 4 deletions

View File

@@ -40,6 +40,7 @@ import {
isValidFilenameInWidows,
} from "@lib/string_and_binary/path.ts";
import { MARK_LOG_SEPARATOR } from "@lib/services/lib/logUtils.ts";
import { NetworkWarningStyles } from "@lib/common/models/setting.const.ts";
// This module cannot be a core module because it depends on the Obsidian UI.
@@ -282,7 +283,20 @@ 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);
const stringMessages = messages.filter((m): m is string => typeof m === "string"); // for 'startsWith'
const networkMessages = stringMessages.filter((m) => m.startsWith("\u{200b}"));
const otherMessages = stringMessages.filter((m) => !m.startsWith("\u{200b}"));
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");
}
}

View File

@@ -4,6 +4,8 @@ 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";
import { NetworkWarningStyles } from "@lib/common/models/setting.const.ts";
export function paneGeneral(
this: ObsidianLiveSyncSettingTab,
paneEl: HTMLElement,
@@ -24,6 +26,16 @@ export function paneGeneral(
});
new Setting(paneEl).autoWireToggle("showStatusOnStatusbar");
new Setting(paneEl).autoWireToggle("hideFileWarningNotice");
new Setting(paneEl).autoWireDropDown("networkWarningStyle", {
options: {
[NetworkWarningStyles.BANNER]: "Show full banner",
[NetworkWarningStyles.ICON]: "Show icon only",
[NetworkWarningStyles.HIDDEN]: "Hide completely",
},
});
this.addOnSaved("networkWarningStyle", () => {
eventHub.emitEvent(EVENT_ON_UNRESOLVED_ERROR);
});
});
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleLogging")).then((paneEl) => {
paneEl.addClass("wizardHidden");