From ead4157754dddc9710c6f0d8a7512ac1a8a6537e Mon Sep 17 00:00:00 2001 From: Verity <113909005+uthvah@users.noreply.github.com> Date: Sun, 14 Jun 2026 16:49:48 +0100 Subject: [PATCH] Added hide linked mentions setting closes #19 and #38 --- main.js | 14 ++++++++++++++ src/main.js | 11 +++++++++++ src/settings.js | 10 ++++++++++ styles.css | 4 ++++ 4 files changed, 39 insertions(+) diff --git a/main.js b/main.js index 0869324..f2cb2cf 100644 --- a/main.js +++ b/main.js @@ -1311,6 +1311,10 @@ var require_settings = __commonJS({ this.plugin.settings.showFocusHighlight = value; await this.plugin.saveSettings(); })); + new Setting(containerEl).setName("Hide linked mentions").setDesc("Hide the linked mentions panel that appears at the bottom of embedded notes").addToggle((toggle) => toggle.setValue(this.plugin.settings.hideLinkedMentions).onChange(async (value) => { + this.plugin.settings.hideLinkedMentions = value; + await this.plugin.saveSettings(); + })); containerEl.createEl("h3", { text: "Header Management" }); new Setting(containerEl).setName("Show header hints").setDesc("Display helpful notices when header creation is blocked in section embeds").addToggle((toggle) => toggle.setValue(this.plugin.settings.showHeaderHints).onChange(async (value) => { this.plugin.settings.showHeaderHints = value; @@ -1470,6 +1474,7 @@ var DEFAULT_SETTINGS = { showFocusHighlight: true, showHeaderHints: true, // NEW: Header hints (enforcement is always on) + hideLinkedMentions: true, debugMode: false }; module.exports = class SyncEmbedPlugin extends Plugin { @@ -1530,6 +1535,7 @@ module.exports = class SyncEmbedPlugin extends Plugin { this.registerDomEvent(document, "focusout", this.trackFocusLoss.bind(this)); this.addSettingTab(new SyncEmbedsSettingTab(this.app, this)); this.updateFocusHighlight(); + this.updateLinkedMentions(); this.log("Sync Embeds plugin loaded successfully"); } onunload() { @@ -1669,6 +1675,7 @@ module.exports = class SyncEmbedPlugin extends Plugin { await this.saveData(this.settings); this.refreshAllEmbeds(); this.updateFocusHighlight(); + this.updateLinkedMentions(); } updateFocusHighlight() { if (this.settings.showFocusHighlight) { @@ -1677,6 +1684,13 @@ module.exports = class SyncEmbedPlugin extends Plugin { document.body.addClass("sync-embeds-no-focus-highlight"); } } + updateLinkedMentions() { + if (this.settings.hideLinkedMentions) { + document.body.addClass("sync-embeds-hide-linked-mentions"); + } else { + document.body.removeClass("sync-embeds-hide-linked-mentions"); + } + } refreshAllEmbeds() { document.querySelectorAll(".sync-container").forEach((container) => { container.style.setProperty("--sync-embed-height", this.settings.embedHeight); diff --git a/src/main.js b/src/main.js index cdcd0e7..6aa50e6 100644 --- a/src/main.js +++ b/src/main.js @@ -15,6 +15,7 @@ const DEFAULT_SETTINGS = { lazyLoadThreshold: '100px', showFocusHighlight: true, showHeaderHints: true, // NEW: Header hints (enforcement is always on) + hideLinkedMentions: true, debugMode: false }; @@ -90,6 +91,7 @@ module.exports = class SyncEmbedPlugin extends Plugin { // Apply focus highlight setting this.updateFocusHighlight(); + this.updateLinkedMentions(); // Log successful load this.log('Sync Embeds plugin loaded successfully'); @@ -271,6 +273,7 @@ module.exports = class SyncEmbedPlugin extends Plugin { await this.saveData(this.settings); this.refreshAllEmbeds(); this.updateFocusHighlight(); + this.updateLinkedMentions(); } updateFocusHighlight() { @@ -281,6 +284,14 @@ module.exports = class SyncEmbedPlugin extends Plugin { } } + updateLinkedMentions() { + if (this.settings.hideLinkedMentions) { + document.body.addClass('sync-embeds-hide-linked-mentions'); + } else { + document.body.removeClass('sync-embeds-hide-linked-mentions'); + } + } + refreshAllEmbeds() { // Update CSS variables for all sync containers document.querySelectorAll('.sync-container').forEach(container => { diff --git a/src/settings.js b/src/settings.js index 8b45d1b..220d276 100644 --- a/src/settings.js +++ b/src/settings.js @@ -168,6 +168,16 @@ class SyncEmbedsSettingTab extends PluginSettingTab { await this.plugin.saveSettings(); })); + new Setting(containerEl) + .setName('Hide linked mentions') + .setDesc('Hide the linked mentions panel that appears at the bottom of embedded notes') + .addToggle(toggle => toggle + .setValue(this.plugin.settings.hideLinkedMentions) + .onChange(async (value) => { + this.plugin.settings.hideLinkedMentions = value; + await this.plugin.saveSettings(); + })); + // === HEADER MANAGEMENT SECTION === containerEl.createEl('h3', { text: 'Header Management' }); diff --git a/styles.css b/styles.css index 919254b..75f2bed 100644 --- a/styles.css +++ b/styles.css @@ -301,6 +301,10 @@ body.sync-embeds-no-focus-highlight .sync-embed:focus-within { outline-color: transparent; } +body.sync-embeds-hide-linked-mentions .sync-embed .embedded-backlinks { + display: none !important; +} + /* === SCROLLBAR === */ .sync-embed::-webkit-scrollbar { width: 8px;