diff --git a/.vault/rich-foot-example/.obsidian/plugins/rich-foot/main.js b/.vault/rich-foot-example/.obsidian/plugins/rich-foot/main.js index 4c34a02..e81c718 100644 --- a/.vault/rich-foot-example/.obsidian/plugins/rich-foot/main.js +++ b/.vault/rich-foot-example/.obsidian/plugins/rich-foot/main.js @@ -107,7 +107,7 @@ var ReleaseNotesModal = class extends import_obsidian.Modal { }; // virtual-module:virtual:release-notes -var releaseNotes = '

\u{1F6D1} Exclude Me Please

\n

[1.10.8] - 2025-01-25

\n

\u2728 Added

\n\n

\u{1F41B} Fixed

\n\n

[1.10.7] - 2025-01-13

\n

\u{1F4E6} Updated

\n\n

[1.10.6] - 2025-01-10

\n

\u{1F4E6} Updated

\n\n

[1.10.5] - 2024-12-26

\n

\u{1F4E6} Updated

\n\n

[1.10.4] - 2024-12-23

\n

\u{1F41B} Fixed

\n\n

[1.10.3] - 2024-12-14

\n

\u{1F41B} Fixed

\n\n

[1.10.2] - 2024-12-11

\n

\u{1F41B} Fixed

\n\n

[1.10.1] - 2024-12-10

\n

\u{1F41B} Fixed

\n\n

[1.10.0] - 2024-12-08

\n

\u2728 Added

\n\n

screenshot

\n'; +var releaseNotes = '

\u{1F6D1} Exclude Me Please

\n

[1.10.9] - 2025-01-25

\n

\u{1F41B} Fixed

\n\n

[1.10.8] - 2025-01-25

\n

\u2728 Added

\n\n

\u{1F41B} Fixed

\n\n

[1.10.7] - 2025-01-13

\n

\u{1F4E6} Updated

\n\n

[1.10.6] - 2025-01-10

\n

\u{1F4E6} Updated

\n\n

[1.10.5] - 2024-12-26

\n

\u{1F4E6} Updated

\n\n

[1.10.4] - 2024-12-23

\n

\u{1F41B} Fixed

\n\n

[1.10.3] - 2024-12-14

\n

\u{1F41B} Fixed

\n\n

[1.10.2] - 2024-12-11

\n

\u{1F41B} Fixed

\n\n

[1.10.1] - 2024-12-10

\n

\u{1F41B} Fixed

\n\n

[1.10.0] - 2024-12-08

\n

\u2728 Added

\n\n

screenshot

\n'; // src/settings.js var import_obsidian2 = require("obsidian"); @@ -787,7 +787,7 @@ var RichFootPlugin = class extends import_obsidian3.Plugin { return; } if (this.shouldExcludeFile(file.path)) { - const existingRichFoots2 = document.querySelectorAll(".rich-foot"); + const existingRichFoots2 = view.contentEl.querySelectorAll(".rich-foot"); existingRichFoots2.forEach((el) => el.remove()); return; } @@ -809,7 +809,7 @@ var RichFootPlugin = class extends import_obsidian3.Plugin { } if ((_h = (_g = this.settings) == null ? void 0 : _g.excludedParentSelectors) == null ? void 0 : _h.some((selector) => { try { - const matchingElements = document.querySelectorAll(selector); + const matchingElements = content.querySelectorAll(selector); return Array.from(matchingElements).some( (el) => el === container || el.contains(container) ); @@ -818,15 +818,15 @@ var RichFootPlugin = class extends import_obsidian3.Plugin { return false; } })) { - const existingRichFoots2 = document.querySelectorAll(".rich-foot"); + const existingRichFoots2 = view.contentEl.querySelectorAll(".rich-foot"); existingRichFoots2.forEach((el) => el.remove()); return; } - const existingRichFoots = document.querySelectorAll(".rich-foot"); + const existingRichFoots = view.contentEl.querySelectorAll(".rich-foot"); existingRichFoots.forEach((el) => el.remove()); this.disconnectObservers(); const richFoot = await this.createRichFoot(file); - const newCheck = document.querySelectorAll(".rich-foot"); + const newCheck = view.contentEl.querySelectorAll(".rich-foot"); if (newCheck.length > 0) { newCheck.forEach((el) => el.remove()); } diff --git a/.vault/rich-foot-example/.obsidian/plugins/rich-foot/manifest.json b/.vault/rich-foot-example/.obsidian/plugins/rich-foot/manifest.json index ef4b027..acef5bb 100644 --- a/.vault/rich-foot-example/.obsidian/plugins/rich-foot/manifest.json +++ b/.vault/rich-foot-example/.obsidian/plugins/rich-foot/manifest.json @@ -1,7 +1,7 @@ { "id": "rich-foot", "name": "Rich Foot", - "version": "1.10.8", + "version": "1.10.9", "minAppVersion": "1.5.0", "description": "Adds backlink tags and created/modified dates to the footer of your notes.", "author": "Justin Parker (eQui\\\\ Labs)", diff --git a/.vault/rich-foot-example/.obsidian/workspace.json b/.vault/rich-foot-example/.obsidian/workspace.json index bf12a6e..f186fb6 100644 --- a/.vault/rich-foot-example/.obsidian/workspace.json +++ b/.vault/rich-foot-example/.obsidian/workspace.json @@ -4,11 +4,11 @@ "type": "split", "children": [ { - "id": "fbb1972d09fe87dc", + "id": "a294327416f762c9", "type": "tabs", "children": [ { - "id": "946d262197156fcf", + "id": "934f926a39fbc7ea", "type": "leaf", "state": { "type": "markdown", @@ -3919,6 +3919,16 @@ { "id": "0d004a3f9d44c37f", "type": "leaf", + "state": { + "type": "empty", + "state": {}, + "icon": "lucide-file", + "title": "New tab" + } + }, + { + "id": "0a9c94949116cd24", + "type": "leaf", "state": { "type": "Saved Queries View", "state": {}, @@ -3927,7 +3937,7 @@ } }, { - "id": "0a9c94949116cd24", + "id": "d4cd6a1735ae60c9", "type": "leaf", "state": { "type": "Saved Queries View", @@ -3937,7 +3947,7 @@ } } ], - "currentTab": 383 + "currentTab": 384 } ], "direction": "horizontal", @@ -3957,20 +3967,20 @@ "obsidian-kanban:Create new board": false } }, - "active": "0a9c94949116cd24", + "active": "934f926a39fbc7ea", "lastOpenFiles": [ - "Untitled.md", + "misc-notes/link test 2.md", + "misc-notes/one.md", + "releases/v1.7.0 - 📆 Dates Your Way.md", + "releases/v1.8.0 - 🫣 Page Preview Support.md", + "releases/v1.9.0 - 🥙 Stuffed Links.md", + "releases/v1.10.0 - 🛑 Exclude Me Please.md", "🦶 Rich Foot.md", + "Untitled.md", "misc-notes/link test.md", "exclude/no rich-feet here.md", - "releases/v1.10.0 - 🛑 Exclude Me Please.md", - "misc-notes/link test 2.md", "misc-notes/two.md", "misc-notes/three.md", - "misc-notes/one.md", - "releases/v1.8.0 - 🫣 Page Preview Support.md", - "releases/v1.9.0 - 🥙 Stuffed Links.md", - "releases/v1.7.0 - 📆 Dates Your Way.md", "images/rich-feet-3.jpg", "images/rich-feet-2.jpg", "images/rich-feet.jpg", diff --git a/CHANGELOG.md b/CHANGELOG.md index 93b0ba2..53f1289 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to Rich Foot will be documented in this file. +## [1.10.9] - 2025-01-25 +### 🐛 Fixed +- Addressed issue with Rich Foot being duplicated when a note was opened in a "new window" + ## [1.10.8] - 2025-01-25 ### ✨ Added - Outlink collections now include embedded notes diff --git a/UPDATE.md b/UPDATE.md index 9c4b35c..5f04634 100644 --- a/UPDATE.md +++ b/UPDATE.md @@ -1,5 +1,9 @@ ## 🛑 Exclude Me Please +## [1.10.9] - 2025-01-25 +### 🐛 Fixed +- Addressed issue with Rich Foot being duplicated when a note was opened in a "new window" + ## [1.10.8] - 2025-01-25 ### ✨ Added - Outlink collections now include embedded notes diff --git a/example-vault.zip b/example-vault.zip index 202e053..b2f0e4f 100644 Binary files a/example-vault.zip and b/example-vault.zip differ diff --git a/manifest.json b/manifest.json index ef4b027..acef5bb 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "rich-foot", "name": "Rich Foot", - "version": "1.10.8", + "version": "1.10.9", "minAppVersion": "1.5.0", "description": "Adds backlink tags and created/modified dates to the footer of your notes.", "author": "Justin Parker (eQui\\\\ Labs)", diff --git a/src/main.js b/src/main.js index 6f29aeb..b0e1ef1 100644 --- a/src/main.js +++ b/src/main.js @@ -211,7 +211,8 @@ class RichFootPlugin extends Plugin { // Check if the current file is in an excluded folder or has excluded parent if (this.shouldExcludeFile(file.path)) { - const existingRichFoots = document.querySelectorAll('.rich-foot'); + // Only remove rich-foot elements within this view's container + const existingRichFoots = view.contentEl.querySelectorAll('.rich-foot'); existingRichFoots.forEach(el => el.remove()); return; } @@ -240,7 +241,7 @@ class RichFootPlugin extends Plugin { // Additional check for excluded parent selectors directly on the container if (this.settings?.excludedParentSelectors?.some(selector => { try { - const matchingElements = document.querySelectorAll(selector); + const matchingElements = content.querySelectorAll(selector); return Array.from(matchingElements).some(el => el === container || el.contains(container) @@ -250,13 +251,14 @@ class RichFootPlugin extends Plugin { return false; } })) { - const existingRichFoots = document.querySelectorAll('.rich-foot'); + // Only remove rich-foot elements within this view's container + const existingRichFoots = view.contentEl.querySelectorAll('.rich-foot'); existingRichFoots.forEach(el => el.remove()); return; } - // Remove ALL existing Rich Foot elements from the document BEFORE creating new one - const existingRichFoots = document.querySelectorAll('.rich-foot'); + // Remove existing Rich Foot elements only from this view's container + const existingRichFoots = view.contentEl.querySelectorAll('.rich-foot'); existingRichFoots.forEach(el => el.remove()); // Disconnect observers @@ -266,7 +268,8 @@ class RichFootPlugin extends Plugin { const richFoot = await this.createRichFoot(file); // Double check no rich-foot was added while we were creating this one - const newCheck = document.querySelectorAll('.rich-foot'); + // Only check within this view's container + const newCheck = view.contentEl.querySelectorAll('.rich-foot'); if (newCheck.length > 0) { newCheck.forEach(el => el.remove()); }