From 381da4558935b357ff45535e860ca57d8a017c0f Mon Sep 17 00:00:00 2001
From: DecafDev <40307803+decaf-dev@users.noreply.github.com>
Date: Wed, 3 Jul 2024 17:24:17 -0600
Subject: [PATCH 1/7] refactor: move general settings to top
---
src/obsidian/vault-explorer-settings-tab.ts | 95 +++++++++++----------
1 file changed, 48 insertions(+), 47 deletions(-)
diff --git a/src/obsidian/vault-explorer-settings-tab.ts b/src/obsidian/vault-explorer-settings-tab.ts
index bbf6b67..98664b2 100644
--- a/src/obsidian/vault-explorer-settings-tab.ts
+++ b/src/obsidian/vault-explorer-settings-tab.ts
@@ -28,6 +28,54 @@ export default class VaultExplorerSettingsTab extends PluginSettingTab {
const dateTimeProperties = getObsidianPropertiesByType(this.app, "datetime");
const checkboxProperties = getObsidianPropertiesByType(this.app, "checkbox");
+ new Setting(containerEl).setName("General").setHeading();
+
+ new Setting(containerEl).setName("Page size").setDesc("The number of items to display per page.").addDropdown(dropdown => dropdown
+ .addOptions({
+ "10": "10",
+ "25": "25",
+ "50": "50",
+ "100": "100",
+ "250": "250",
+ "500": "500",
+ })
+ .setValue(this.plugin.settings.pageSize.toString())
+ .onChange(async (value) => {
+ this.plugin.settings.pageSize = parseInt(value);
+ await this.plugin.saveSettings();
+ EventManager.getInstance().emit("page-size-setting-change");
+ }));
+ new Setting(containerEl)
+ .setName("Title wrapping")
+ .setDesc(
+ "Sets the wrapping style for the title."
+ )
+ .addDropdown((cb) => {
+ cb.addOptions({
+ "normal": "Normal",
+ "break-word": "Break Word",
+ })
+ cb.setValue(this.plugin.settings.titleWrapping).onChange(
+ async (value) => {
+ this.plugin.settings.titleWrapping = value as WordBreak;
+ await this.plugin.saveSettings();
+ EventManager.getInstance().emit("title-wrapping-setting-change");
+ }
+ );
+ });
+
+ new Setting(containerEl)
+ .setName("Enable scroll buttons")
+ .setDesc("When enabled, scroll buttons will be displayed for scrollable content.")
+ .addToggle(toggle => toggle
+ .setValue(this.plugin.settings.enableScrollButtons)
+ .onChange(async (value) => {
+ this.plugin.settings.enableScrollButtons = value;
+ await this.plugin.saveSettings();
+ EventManager.getInstance().emit("scroll-buttons-setting-change");
+ }));
+
+
new Setting(containerEl).setName("Filters").setHeading();
new Setting(containerEl)
@@ -168,53 +216,6 @@ export default class VaultExplorerSettingsTab extends PluginSettingTab {
EventManager.getInstance().emit("view-toggle-setting-change");
}));
- new Setting(containerEl).setName("General").setHeading();
-
- new Setting(containerEl).setName("Page size").setDesc("The number of items to display per page.").addDropdown(dropdown => dropdown
- .addOptions({
- "10": "10",
- "25": "25",
- "50": "50",
- "100": "100",
- "250": "250",
- "500": "500",
- })
- .setValue(this.plugin.settings.pageSize.toString())
- .onChange(async (value) => {
- this.plugin.settings.pageSize = parseInt(value);
- await this.plugin.saveSettings();
- EventManager.getInstance().emit("page-size-setting-change");
- }));
- new Setting(containerEl)
- .setName("Title wrapping")
- .setDesc(
- "Sets the wrapping style for the title."
- )
- .addDropdown((cb) => {
- cb.addOptions({
- "normal": "Normal",
- "break-word": "Break Word",
- })
- cb.setValue(this.plugin.settings.titleWrapping).onChange(
- async (value) => {
- this.plugin.settings.titleWrapping = value as WordBreak;
- await this.plugin.saveSettings();
- EventManager.getInstance().emit("title-wrapping-setting-change");
- }
- );
- });
-
- new Setting(containerEl)
- .setName("Enable scroll buttons")
- .setDesc("When enabled, scroll buttons will be displayed for scrollable content.")
- .addToggle(toggle => toggle
- .setValue(this.plugin.settings.enableScrollButtons)
- .onChange(async (value) => {
- this.plugin.settings.enableScrollButtons = value;
- await this.plugin.saveSettings();
- EventManager.getInstance().emit("scroll-buttons-setting-change");
- }));
-
new Setting(containerEl).setName("Built-in properties").setHeading();
new Setting(containerEl)
From f95becd65f99f4234d35593faa8f9ed764404231 Mon Sep 17 00:00:00 2001
From: DecafDev <40307803+decaf-dev@users.noreply.github.com>
Date: Wed, 3 Jul 2024 17:25:12 -0600
Subject: [PATCH 2/7] refactor: rename to creation and modification
---
src/obsidian/vault-explorer-settings-tab.ts | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/obsidian/vault-explorer-settings-tab.ts b/src/obsidian/vault-explorer-settings-tab.ts
index 98664b2..80ed5a4 100644
--- a/src/obsidian/vault-explorer-settings-tab.ts
+++ b/src/obsidian/vault-explorer-settings-tab.ts
@@ -240,18 +240,18 @@ export default class VaultExplorerSettingsTab extends PluginSettingTab {
EventManager.getInstance().emit("property-setting-change");
}));
- const createdDateDesc = new DocumentFragment();
- createdDateDesc.createDiv({
+ const creationDateDesc = new DocumentFragment();
+ creationDateDesc.createDiv({
text: "The property containing the creation date. This must be a date or datetime property.",
});
- createdDateDesc.createDiv({
+ creationDateDesc.createDiv({
text: "If set to 'Select a property', the file's created at date will be used.",
});
new Setting(containerEl)
- .setName("Created date property")
- .setDesc(createdDateDesc)
+ .setName("Creation date property")
+ .setDesc(creationDateDesc)
.addDropdown(dropdown => dropdown.addOptions(getDropdownOptionsForProperties([...dateProperties, ...dateTimeProperties]))
.setValue(this.plugin.settings.properties.createdDate)
.onChange(async (value) => {
@@ -260,17 +260,17 @@ export default class VaultExplorerSettingsTab extends PluginSettingTab {
EventManager.getInstance().emit("property-setting-change");
}));
- const modifiedDateDesc = new DocumentFragment();
- modifiedDateDesc.createDiv({
+ const modificationDateDesc = new DocumentFragment();
+ modificationDateDesc.createDiv({
text: "The property containing the modification date. This must be a date or datetime property.",
});
- modifiedDateDesc.createDiv({
+ modificationDateDesc.createDiv({
text: "If set to 'Select a property', the file's modified at date will be used.",
});
new Setting(containerEl)
- .setName('Modified date property')
- .setDesc(modifiedDateDesc)
+ .setName('Modification date property')
+ .setDesc(modificationDateDesc)
.addDropdown(dropdown => dropdown.addOptions(getDropdownOptionsForProperties([...dateProperties, ...dateTimeProperties]))
.setValue(this.plugin.settings.properties.modifiedDate)
.onChange(async (value) => {
From 7fa13b0642bc2eca8be3d1b8a2bd5e9ff2a5e246 Mon Sep 17 00:00:00 2001
From: DecafDev <40307803+decaf-dev@users.noreply.github.com>
Date: Fri, 5 Jul 2024 22:21:32 -0600
Subject: [PATCH 3/7] style: add prettierrc
---
.prettierrc | 9 +++++++++
1 file changed, 9 insertions(+)
create mode 100644 .prettierrc
diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 0000000..1d33228
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,9 @@
+{
+ "tabWidth": 4,
+ "useTabs": true,
+ "endOfLine": "lf",
+ "charset": "utf-8",
+ "insertFinalNewline": false,
+ "semi": true,
+ "quotes": "double"
+}
From 1d3fe1ab9c1fc179fa8ff7a3a7c14c8271221a16 Mon Sep 17 00:00:00 2001
From: DecafDev <40307803+decaf-dev@users.noreply.github.com>
Date: Fri, 5 Jul 2024 22:22:06 -0600
Subject: [PATCH 4/7] fix: eliminate pagination indicator jump on view resize
---
.../app/components/custom-filter.svelte | 4 --
.../components/pagination-indicator.svelte | 48 +++++++++++++++++--
src/svelte/app/index.svelte | 2 +-
src/svelte/shared/components/stack.svelte | 7 ++-
4 files changed, 51 insertions(+), 10 deletions(-)
diff --git a/src/svelte/app/components/custom-filter.svelte b/src/svelte/app/components/custom-filter.svelte
index cb8f517..0538948 100644
--- a/src/svelte/app/components/custom-filter.svelte
+++ b/src/svelte/app/components/custom-filter.svelte
@@ -43,10 +43,6 @@
diff --git a/src/svelte/app/index.svelte b/src/svelte/app/index.svelte
index 1552b55..46a19b2 100644
--- a/src/svelte/app/index.svelte
+++ b/src/svelte/app/index.svelte
@@ -862,6 +862,6 @@
}
.vault-explorer-view-select {
- margin-left: -4px;
+ flex: 1;
}
diff --git a/src/svelte/shared/components/stack.svelte b/src/svelte/shared/components/stack.svelte
index 89a0c46..9c57d98 100644
--- a/src/svelte/shared/components/stack.svelte
+++ b/src/svelte/shared/components/stack.svelte
@@ -7,7 +7,8 @@
| "flex-end"
| "unset" = "unset";
export let align: "flex-start" | "center" | "flex-end" | "unset" = "unset";
- export let direction: "row" | "column" = "row";
+ export let direction: "row" | "column" | "row-reverse" | "column-reverse" =
+ "row";
export let width = "unset";
export let height = "unset";
@@ -38,7 +39,9 @@
flex-direction: {direction};
justify-content: {justify};
align-items: {align};
- {direction === 'row' ? 'column-gap' : 'row-gap'}: {spacingPx}px;
+ {direction === 'row' || direction === 'row-reverse'
+ ? 'column-gap'
+ : 'row-gap'}: {spacingPx}px;
width: {width};
height: {height};
"
From 55ff7cad9dc74ffb8b9223ac58002e8e9c4a2dd5 Mon Sep 17 00:00:00 2001
From: DecafDev <40307803+decaf-dev@users.noreply.github.com>
Date: Fri, 5 Jul 2024 22:42:02 -0600
Subject: [PATCH 5/7] fix: resolve current page greater than total pages
---
src/svelte/app/index.svelte | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/svelte/app/index.svelte b/src/svelte/app/index.svelte
index 46a19b2..eea1673 100644
--- a/src/svelte/app/index.svelte
+++ b/src/svelte/app/index.svelte
@@ -760,6 +760,12 @@
$: totalItems = renderData.length;
$: totalPages = Math.ceil(totalItems / pageSize);
+ //When using filters, the total pages can be less than the current page
+ //in this case, reset the current page to 1
+ $: if (totalPages < currentPage) {
+ currentPage = 1;
+ }
+
let currentPage = 1;
$: startIndex = (currentPage - 1) * pageSize;
$: pageLength = Math.min(pageSize, renderData.length - startIndex);
From 4aff1789caff8f2bde9a3a73b69fadc2fe73688b Mon Sep 17 00:00:00 2001
From: DecafDev <40307803+decaf-dev@users.noreply.github.com>
Date: Fri, 5 Jul 2024 22:46:13 -0600
Subject: [PATCH 6/7] fix: move pagination indicator to the right
---
src/svelte/app/components/pagination-indicator.svelte | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/svelte/app/components/pagination-indicator.svelte b/src/svelte/app/components/pagination-indicator.svelte
index 076550d..04a007b 100644
--- a/src/svelte/app/components/pagination-indicator.svelte
+++ b/src/svelte/app/components/pagination-indicator.svelte
@@ -56,7 +56,7 @@
From 32cd396fe42e27e672556925b2c30635de19e545 Mon Sep 17 00:00:00 2001
From: DecafDev <40307803+decaf-dev@users.noreply.github.com>
Date: Fri, 5 Jul 2024 22:47:15 -0600
Subject: [PATCH 7/7] chore: bump version
---
manifest.json | 2 +-
package.json | 2 +-
versions.json | 3 ++-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/manifest.json b/manifest.json
index 83158ed..1ca7e07 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,7 +1,7 @@
{
"id": "vault-explorer",
"name": "Vault Explorer",
- "version": "1.18.1",
+ "version": "1.18.2",
"minAppVersion": "1.4.13",
"description": "Explore your vault in visual format",
"author": "DecafDev",
diff --git a/package.json b/package.json
index 1fafe50..1c359c3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "obsidian-vault-explorer",
- "version": "1.18.1",
+ "version": "1.18.2",
"description": "Explore your vault in visual format",
"main": "main.js",
"scripts": {
diff --git a/versions.json b/versions.json
index 0e6d773..9723ac2 100644
--- a/versions.json
+++ b/versions.json
@@ -77,5 +77,6 @@
"1.17.1": "1.4.13",
"1.17.2": "1.4.13",
"1.18.0": "1.4.13",
- "1.18.1": "1.4.13"
+ "1.18.1": "1.4.13",
+ "1.18.2": "1.4.13"
}