Add settings toggle for properties button

This commit is contained in:
luwai 2025-12-14 12:15:37 -05:00
parent 4128411bb2
commit 5d4616aae9
3 changed files with 20 additions and 6 deletions

View file

@ -372,12 +372,15 @@ class EmbedManager {
propertiesEl.classList.add('is-collapsed');
const toggleBtn = propertiesEl.createDiv('properties-collapse-toggle');
toggleBtn.innerHTML = 'â–¶';
toggleBtn.onclick = () => {
propertiesEl.classList.toggle('is-collapsed');
toggleBtn.innerHTML = propertiesEl.classList.contains('is-collapsed') ? 'â–¶' : 'â–¼';
};
// Only create toggle button if setting is enabled
if (this.plugin.settings.showPropertiesToggle) {
const toggleBtn = propertiesEl.createDiv('properties-collapse-toggle');
toggleBtn.innerHTML = '▶';
toggleBtn.onclick = () => {
propertiesEl.classList.toggle('is-collapsed');
toggleBtn.innerHTML = propertiesEl.classList.contains('is-collapsed') ? '▶' : '▼';
};
}
}, 100);
});
}

View file

@ -15,6 +15,7 @@ const DEFAULT_SETTINGS = {
showFocusHighlight: true,
showHeaderHints: true, // NEW: Header hints (enforcement is always on)
hideSectionHeaders: false, // NEW: Hide headers in section embeds
showPropertiesToggle: true, // NEW: Show properties collapse toggle button
debugMode: false
};

View file

@ -138,6 +138,16 @@ class SyncEmbedsSettingTab extends PluginSettingTab {
await this.plugin.saveSettings();
}));
new Setting(containerEl)
.setName('Show properties toggle button')
.setDesc('Display a toggle button to collapse/expand properties in embeds')
.addToggle(toggle => toggle
.setValue(this.plugin.settings.showPropertiesToggle)
.onChange(async (value) => {
this.plugin.settings.showPropertiesToggle = value;
await this.plugin.saveSettings();
}));
new Setting(containerEl)
.setName('Show inline title')
.setDesc('Display note title at the top of whole-note embeds (not applicable to section embeds or embeds with aliases)')