From a6285a62ca3a9938f9b1b2e8e2284f3d8df4e12d Mon Sep 17 00:00:00 2001 From: Kageetai Date: Tue, 28 Nov 2023 16:47:56 +0100 Subject: [PATCH] fix: fix time span settings with identical names colliding --- manifest.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/settingsTab.ts | 21 +++++++++++++-------- src/styles-settings.css | 13 +++++++++++++ versions.json | 3 ++- 6 files changed, 32 insertions(+), 13 deletions(-) diff --git a/manifest.json b/manifest.json index e6b7120..7df516f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "journal-review", "name": "Journal Review", - "version": "2.0.7", + "version": "2.0.8", "minAppVersion": "0.15.0", "description": "Review your daily notes on their anniversaries, like \"what happened today last year\".", "author": "Kageetai", diff --git a/package-lock.json b/package-lock.json index 8f0e19b..7f2330b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "obsidian-plugin-journal-review", - "version": "1.1.0", + "version": "2.0.8", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "obsidian-plugin-journal-review", - "version": "1.1.0", + "version": "2.0.8", "license": "MIT", "dependencies": { "obsidian-daily-notes-interface": "^0.9.4", diff --git a/package.json b/package.json index 34081e0..919ea4f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-plugin-journal-review", - "version": "2.0.7", + "version": "2.0.8", "description": "Review your daily notes on their anniversaries, like \"what happened today last year\"\n\n", "main": "main.js", "scripts": { diff --git a/src/settingsTab.ts b/src/settingsTab.ts index 8c156be..ea2ae72 100644 --- a/src/settingsTab.ts +++ b/src/settingsTab.ts @@ -45,20 +45,25 @@ export class SettingsTab extends PluginSettingTab { const timeSpanContainer = container.createEl("li"); new Setting(timeSpanContainer) - .setName(getTimeSpanTitle({ number, unit, recurring })) + .setName(`Time span #${index + 1}`) + .setDesc(getTimeSpanTitle({ number, unit, recurring })) .addSlider((slider) => slider .setValue(number) .setLimits(1, getMaxTimeSpan(unit), 1) .setDynamicTooltip() .onChange( - debounce((value) => { - this.plugin.settings.timeSpans[ - index - ].number = value; - this.plugin.saveSettings(); - this.display(); - }, DEBOUNCE_DELAY), + debounce( + (value) => { + this.plugin.settings.timeSpans[ + index + ].number = value; + this.plugin.saveSettings(); + this.display(); + }, + DEBOUNCE_DELAY, + true, + ), ), ) .addDropdown((dropdown) => diff --git a/src/styles-settings.css b/src/styles-settings.css index 6ba3c73..6e8a676 100644 --- a/src/styles-settings.css +++ b/src/styles-settings.css @@ -17,5 +17,18 @@ gap: 1rem; padding-top: 0; border-top: none; + + /* hide setting name */ + & .setting-item-name { + display: none; + } + + /* display description instead */ + & .setting-item-description { + color: var(--text-normal); + font-size: var(--font-ui-medium); + padding-top: 0; + line-height: var(--line-height-normal); + } } } diff --git a/versions.json b/versions.json index 7779aa9..81791f9 100644 --- a/versions.json +++ b/versions.json @@ -10,5 +10,6 @@ "2.0.4": "0.15.0", "2.0.5": "0.15.0", "2.0.6": "0.15.0", - "2.0.7": "0.15.0" + "2.0.7": "0.15.0", + "2.0.8": "0.15.0" } \ No newline at end of file