From 0e8d99c9caeeae923fcf68f261f85940d7f0bf99 Mon Sep 17 00:00:00 2001 From: Gary Ritchie Date: Sat, 4 Apr 2026 12:31:42 -0600 Subject: [PATCH] Link empty-state message to plugin settings (#38) * Link "plugin settings" text to open settings tab in empty-state message When no properties are configured, the modal now shows "plugin settings" as a clickable link that closes the modal and navigates directly to the plugin's settings tab. * Guard undocumented settings API with feature detection Check that setting.open and setting.openTabById are functions before calling them. Falls back to a Notice with manual navigation instructions if the internal API is absent. * Add focus-visible indicator for links in the modal --- src/bulk-edit-modal.ts | 20 +++++++++++++++++++- styles.css | 6 ++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/bulk-edit-modal.ts b/src/bulk-edit-modal.ts index c840e49..55fd839 100644 --- a/src/bulk-edit-modal.ts +++ b/src/bulk-edit-modal.ts @@ -182,7 +182,25 @@ export class BulkEditModal extends Modal { const editableProperties = settings.properties.filter(p => p.name !== settings.selectionProperty); if (editableProperties.length === 0) { - contentEl.createEl("p", {text: "No properties configured. Add properties in the plugin settings."}); + const p = contentEl.createEl("p"); + p.appendText("No properties configured. Add properties in the "); + // eslint-disable-next-line obsidianmd/ui/sentence-case -- mid-sentence text + const link = p.createEl("a", {text: "plugin settings", href: "#"}); + link.addEventListener("click", (e) => { + e.preventDefault(); + this.close(); + /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call -- undocumented Obsidian API */ + const setting = (this.app as any).setting; + if (typeof setting?.open === "function" && typeof setting?.openTabById === "function") { + setting.open(); + setting.openTabById(this.plugin.manifest.id); + } else { + // eslint-disable-next-line obsidianmd/ui/sentence-case -- navigation path + new Notice("Open Settings → Community plugins → Bulk Properties to configure properties."); + } + /* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call */ + }); + p.appendText("."); return; } diff --git a/styles.css b/styles.css index 8949308..55d0ef0 100644 --- a/styles.css +++ b/styles.css @@ -12,6 +12,12 @@ font-size: var(--font-ui-medium); } +.bulk-properties-modal a:focus-visible { + outline: 2px solid var(--background-modifier-border-focus); + outline-offset: 2px; + border-radius: var(--radius-s); +} + .bulk-properties-file-list { max-height: 200px; overflow-y: auto;