diff --git a/example-vault/rich-foot-example/.obsidian/plugins/rich-foot/main.js b/example-vault/rich-foot-example/.obsidian/plugins/rich-foot/main.js index 3dcc511..7aaacd0 100644 --- a/example-vault/rich-foot-example/.obsidian/plugins/rich-foot/main.js +++ b/example-vault/rich-foot-example/.obsidian/plugins/rich-foot/main.js @@ -53,21 +53,33 @@ var RichFootPlugin = class extends Plugin { if (view.getMode() === "preview") { container = content.querySelector(".markdown-preview-section"); } else if (view.getMode() === "source" || view.getMode() === "live") { - container = content.querySelector(".cm-scroller"); + container = content.querySelector(".cm-sizer"); } if (!container) { return; } this.removeExistingRichFoot(container); const richFoot = this.createRichFoot(file); - container.appendChild(richFoot); + if (view.getMode() === "source" || view.getMode() === "live") { + container.appendChild(richFoot); + } else { + container.appendChild(richFoot); + } this.observeContainer(container); } removeExistingRichFoot(container) { + var _a; const existingRichFoot = container.querySelector(".rich-foot"); if (existingRichFoot) { existingRichFoot.remove(); } + const cmSizer = (_a = container.closest(".cm-editor")) == null ? void 0 : _a.querySelector(".cm-sizer"); + if (cmSizer) { + const richFootInSizer = cmSizer.querySelector(".rich-foot"); + if (richFootInSizer) { + richFootInSizer.remove(); + } + } } observeContainer(container) { if (this.containerObserver) { diff --git a/example-vault/rich-foot-example/.obsidian/plugins/rich-foot/manifest.json b/example-vault/rich-foot-example/.obsidian/plugins/rich-foot/manifest.json index 39b5432..720d8c9 100644 --- a/example-vault/rich-foot-example/.obsidian/plugins/rich-foot/manifest.json +++ b/example-vault/rich-foot-example/.obsidian/plugins/rich-foot/manifest.json @@ -1,8 +1,8 @@ { "id": "rich-foot", "name": "Rich Foot", - "version": "1.3.2", - "minAppVersion": "1.7.2", + "version": "1.3.3", + "minAppVersion": "1.6.0", "description": "Adds backlink tags and created/modified dates to the footer of your notes.", "author": "Justin Parker", "authorUrl": "https://www.jparkerweb.com", diff --git a/manifest.json b/manifest.json index 39b5432..720d8c9 100644 --- a/manifest.json +++ b/manifest.json @@ -1,8 +1,8 @@ { "id": "rich-foot", "name": "Rich Foot", - "version": "1.3.2", - "minAppVersion": "1.7.2", + "version": "1.3.3", + "minAppVersion": "1.6.0", "description": "Adds backlink tags and created/modified dates to the footer of your notes.", "author": "Justin Parker", "authorUrl": "https://www.jparkerweb.com", diff --git a/src/main.js b/src/main.js index cf92020..fa7f0f0 100644 --- a/src/main.js +++ b/src/main.js @@ -66,7 +66,7 @@ class RichFootPlugin extends Plugin { if (view.getMode() === 'preview') { container = content.querySelector('.markdown-preview-section'); } else if (view.getMode() === 'source' || view.getMode() === 'live') { - container = content.querySelector('.cm-scroller'); + container = content.querySelector('.cm-sizer'); } if (!container) { @@ -80,7 +80,11 @@ class RichFootPlugin extends Plugin { const richFoot = this.createRichFoot(file); // Append the Rich Foot to the container - container.appendChild(richFoot); + if (view.getMode() === 'source' || view.getMode() === 'live') { + container.appendChild(richFoot); + } else { + container.appendChild(richFoot); + } // Set up a mutation observer for this specific container this.observeContainer(container); @@ -91,6 +95,14 @@ class RichFootPlugin extends Plugin { if (existingRichFoot) { existingRichFoot.remove(); } + // Also check in .cm-sizer for editing mode + const cmSizer = container.closest('.cm-editor')?.querySelector('.cm-sizer'); + if (cmSizer) { + const richFootInSizer = cmSizer.querySelector('.rich-foot'); + if (richFootInSizer) { + richFootInSizer.remove(); + } + } } observeContainer(container) {