Skip to content

Commit

Permalink
Fix preview length slider (#168)
Browse files Browse the repository at this point in the history
* fix: fix preview length slider not setting correct value when over 100

* chore: version
  • Loading branch information
Kageetai authored Oct 23, 2024
1 parent b37893a commit ed7b790
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 31 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "journal-review",
"name": "Journal Review",
"version": "2.4.3",
"version": "2.4.4",
"minAppVersion": "0.15.0",
"description": "Review your daily notes on their anniversaries, like \"what happened today last year\".",
"author": "Kageetai",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-plugin-journal-review",
"version": "2.4.3",
"version": "2.4.4",
"description": "Review your daily notes on their anniversaries, like \"what happened today last year\"\n\n",
"main": "main.js",
"scripts": {
Expand Down
57 changes: 29 additions & 28 deletions src/settingsTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ export class SettingsTab extends PluginSettingTab {
.setDesc(getTimeSpanTitle({ number, unit, recurring }))
.addSlider((slider) =>
slider
.setValue(number)
.setLimits(1, getMaxTimeSpan(unit), 1)
.setDynamicTooltip()
.setValue(number)
.onChange(
debounce(
(value) => {
Expand Down Expand Up @@ -88,7 +88,7 @@ export class SettingsTab extends PluginSettingTab {
})
.setTooltip("Recurring?"),
)
.addButton((button) => {
.addButton((button) =>
button
.setButtonText("X")
.setIcon("delete")
Expand All @@ -97,8 +97,8 @@ export class SettingsTab extends PluginSettingTab {
this.plugin.settings.timeSpans.splice(index, 1);
void this.plugin.saveSettings();
this.display();
});
});
}),
);
},
);

Expand All @@ -120,29 +120,15 @@ export class SettingsTab extends PluginSettingTab {
.setDesc(
"The number of days to include before and after the date being checked",
)
.addSlider((slider) => {
.addSlider((slider) =>
slider
.setValue(this.plugin.settings.dayMargin)
.setDynamicTooltip()
.setValue(this.plugin.settings.dayMargin)
.onChange((value) => {
this.plugin.settings.dayMargin = value;
void this.plugin.saveSettings();
});
});

new Setting(containerEl)
.setName("Preview Length")
.setDesc("Length of the preview text to show for each note")
.addSlider((slider) => {
slider
.setValue(this.plugin.settings.previewLength)
.setDynamicTooltip()
.setLimits(0, 1000, 10)
.onChange((value) => {
this.plugin.settings.previewLength = value;
void this.plugin.saveSettings();
});
});
}),
);

new Setting(containerEl)
.setName("Date based on selected note")
Expand All @@ -158,6 +144,21 @@ export class SettingsTab extends PluginSettingTab {

new Setting(containerEl).setName("Previews").setHeading();

new Setting(containerEl)
.setName("Preview Length")
.setDesc("Length of the preview text to show for each note")
.addSlider((slider) =>
slider
.setLimits(0, 1000, 10)
.setDynamicTooltip()
.setValue(this.plugin.settings.previewLength)
.onChange((value) => {
console.log("preview length", value);
this.plugin.settings.previewLength = value;
void this.plugin.saveSettings();
}),
);

new Setting(containerEl)
.setName("Show Note Title with previews")
.setDesc(
Expand Down Expand Up @@ -228,14 +229,14 @@ export class SettingsTab extends PluginSettingTab {
new Setting(containerEl)
.setName("Open in new pane")
.setDesc("Open the notes in a new pane/tab by default when clicking them")
.addToggle((toggle) => {
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.openInNewPane)
.onChange((value) => {
this.plugin.settings.openInNewPane = value;
void this.plugin.saveSettings();
});
});
}),
);

new Setting(containerEl).setName("Other").setHeading();

Expand All @@ -244,14 +245,14 @@ export class SettingsTab extends PluginSettingTab {
.setDesc(
"Use notifications (inside Obsidian) to let you know, when there are new journal entries to review. This will happen when Obsidian is focused and it's a new day.",
)
.addToggle((toggle) => {
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.useNotifications)
.onChange((value) => {
this.plugin.settings.useNotifications = value;
void this.plugin.saveSettings();
});
});
}),
);

new Setting(containerEl)
.setName("Note filtering regex")
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
"2.4.0": "0.15.0",
"2.4.1": "0.15.0",
"2.4.2": "0.15.0",
"2.4.3": "0.15.0"
"2.4.3": "0.15.0",
"2.4.4": "0.15.0"
}

0 comments on commit ed7b790

Please sign in to comment.