Skip to content

Commit a286ffd

Browse files
authored
Merge pull request #321 from decaf-dev/dev
1.41.1
2 parents 66b396b + fd30c3b commit a286ffd

File tree

11 files changed

+110
-43
lines changed

11 files changed

+110
-43
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Check Console Log
2+
3+
on: pull_request
4+
5+
jobs:
6+
check_console_log:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: checkout code
10+
uses: actions/checkout@v3
11+
12+
- name: Run console.log check
13+
run: |
14+
found=$(find src/ -type f ! -name "main.ts" ! -path "*/migrations/index.ts" | xargs grep "console.log" || true)
15+
if [ -n "$found" ]; then
16+
echo "console.log found in the following files:"
17+
echo "$found"
18+
exit 1
19+
fi
20+
echo "No console.log statements found!"

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "vault-explorer",
33
"name": "Vault Explorer",
4-
"version": "1.41.0",
4+
"version": "1.41.1",
55
"minAppVersion": "1.4.13",
66
"description": "Explore your vault in visual format",
77
"author": "DecafDev",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "obsidian-vault-explorer",
3-
"version": "1.41.0",
3+
"version": "1.41.1",
44
"description": "Explore your vault in visual format",
55
"main": "main.js",
66
"scripts": {

src/obsidian/vault-explorer-settings-tab.ts

Lines changed: 64 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { App, PluginSettingTab, Setting } from "obsidian";
1+
import { App, PluginSettingTab, Setting, SliderComponent } from "obsidian";
22
import VaultExplorerPlugin from "src/main";
33
import {
44
getDropdownOptionsForProperties,
@@ -386,59 +386,107 @@ export default class VaultExplorerSettingsTab extends PluginSettingTab {
386386
})
387387
);
388388

389+
let largeScreenLineClampSlider: SliderComponent | null = null;
389390
new Setting(containerEl)
390391
.setName("Large screen line clamp")
391392
.setDesc(
392-
"Number of lines to clamp on large screens (>= 1024px). (2-8, default 5)"
393+
"Number of lines to clamp on large screens (>= 1024px) (2-8, default 5)"
393394
)
394-
.addSlider((component) =>
395-
component
395+
.addExtraButton((button) =>
396+
button
397+
.setIcon("reset")
398+
.setTooltip("Restore default")
399+
.onClick(async () => {
400+
this.plugin.settings.views.feed.lineClampLarge = 5;
401+
largeScreenLineClampSlider?.setValue(5);
402+
await this.plugin.saveSettings();
403+
EventManager.getInstance().emit(
404+
PluginEvent.FEED_CONTENT_SETTING_CHANGE
405+
);
406+
})
407+
)
408+
.addSlider((component) => {
409+
largeScreenLineClampSlider = component;
410+
return component
396411
.setValue(this.plugin.settings.views.feed.lineClampLarge)
397412
.setLimits(2, 8, 1)
413+
.setDynamicTooltip()
398414
.onChange(async (value) => {
399415
this.plugin.settings.views.feed.lineClampLarge = value;
400416
await this.plugin.saveSettings();
401417
EventManager.getInstance().emit(
402418
PluginEvent.FEED_CONTENT_SETTING_CHANGE
403419
);
404-
})
405-
);
420+
});
421+
});
406422

423+
let mediumScreenLineClampSlider: SliderComponent | null = null;
407424
new Setting(containerEl)
408425
.setName("Medium screen line clamp")
409426
.setDesc(
410-
"Number of lines to clamp on medium screens (>= 600px and < 1024px). (2-8, default 3)"
427+
"Number of lines to clamp on medium screens (>= 600px and < 1024px) (2-8, default 3)"
411428
)
412-
.addSlider((component) =>
413-
component
429+
.addExtraButton((button) =>
430+
button
431+
.setIcon("reset")
432+
.setTooltip("Restore default")
433+
.onClick(async () => {
434+
this.plugin.settings.views.feed.lineClampLarge = 3;
435+
mediumScreenLineClampSlider?.setValue(3);
436+
await this.plugin.saveSettings();
437+
EventManager.getInstance().emit(
438+
PluginEvent.FEED_CONTENT_SETTING_CHANGE
439+
);
440+
})
441+
)
442+
.addSlider((component) => {
443+
mediumScreenLineClampSlider = component;
444+
return component
414445
.setValue(this.plugin.settings.views.feed.lineClampMedium)
415446
.setLimits(2, 8, 1)
447+
.setDynamicTooltip()
416448
.onChange(async (value) => {
417449
this.plugin.settings.views.feed.lineClampMedium = value;
418450
await this.plugin.saveSettings();
419451
EventManager.getInstance().emit(
420452
PluginEvent.FEED_CONTENT_SETTING_CHANGE
421453
);
422-
})
423-
);
454+
});
455+
});
424456

457+
let smallScreenLineClampSlider: SliderComponent | null = null;
425458
new Setting(containerEl)
426459
.setName("Small screen line clamp")
427460
.setDesc(
428-
"Number of lines to clamp on small screens (< 600px). (2-8, default 2)"
461+
"Number of lines to clamp on small screens (< 600px) (2-8, default 2)"
429462
)
430-
.addSlider((component) =>
431-
component
463+
.addExtraButton((button) =>
464+
button
465+
.setIcon("reset")
466+
.setTooltip("Restore default")
467+
.onClick(async () => {
468+
this.plugin.settings.views.feed.lineClampLarge = 2;
469+
smallScreenLineClampSlider?.setValue(2);
470+
await this.plugin.saveSettings();
471+
EventManager.getInstance().emit(
472+
PluginEvent.FEED_CONTENT_SETTING_CHANGE
473+
);
474+
})
475+
)
476+
.addSlider((component) => {
477+
smallScreenLineClampSlider = component;
478+
return component
432479
.setValue(this.plugin.settings.views.feed.lineClampSmall)
433480
.setLimits(2, 8, 1)
481+
.setDynamicTooltip()
434482
.onChange(async (value) => {
435483
this.plugin.settings.views.feed.lineClampSmall = value;
436484
await this.plugin.saveSettings();
437485
EventManager.getInstance().emit(
438486
PluginEvent.FEED_CONTENT_SETTING_CHANGE
439487
);
440-
})
441-
);
488+
});
489+
});
442490

443491
new Setting(containerEl).setName("Built-in properties").setHeading();
444492

src/svelte/app/index.svelte

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -790,8 +790,6 @@
790790
value: CoverImageFit;
791791
};
792792
793-
console.log(filePath, value);
794-
795793
const { properties } = plugin.settings;
796794
const { coverImageFit: coverImageFitProperty } = properties;
797795
@@ -897,19 +895,14 @@
897895
) {
898896
formatted = filteredCustom.map((loadedFile) => {
899897
const { id, file } = loadedFile;
900-
const frontmatter =
901-
plugin.app.metadataCache.getFileCache(file)?.frontmatter;
902-
903898
const isFavorite = favoritesCache.get(file.path) ?? null;
904-
905899
const content = contentCache.get(file.path) ?? null;
906900
907901
return formatFileDataForRender({
908902
app: plugin.app,
909903
settings: plugin.settings,
910904
fileId: id,
911905
file,
912-
fileFrontmatter: frontmatter,
913906
fileContent: content,
914907
fileFavorite: isFavorite,
915908
});

src/svelte/app/services/render-data.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,20 @@ export const formatFileDataForRender = ({
4545
settings,
4646
file,
4747
fileId,
48-
fileFrontmatter,
4948
fileContent,
5049
fileFavorite,
5150
}: {
5251
app: App;
5352
settings: VaultExplorerPluginSettings;
5453
file: TFile;
5554
fileId: string;
56-
fileFrontmatter: FrontMatterCache | undefined;
5755
fileContent: string | null;
5856
fileFavorite: boolean | null;
5957
}): FileRenderData => {
6058
const { name, basename, extension, path } = file;
6159

60+
const fileFrontmatter = app.metadataCache.getFileCache(file)?.frontmatter;
61+
6262
const { loadBodyTags } = settings;
6363
const { coverImageSources } = settings.views.grid;
6464
const {
@@ -78,15 +78,14 @@ export const formatFileDataForRender = ({
7878
"tags",
7979
PropertyType.LIST
8080
);
81-
if (fileContent && loadBodyTags) {
82-
const body = removeFrontmatter(fileContent);
83-
const TAG_REGEX = /#\w+(\/\w+)*/g;
84-
const bodyTags = body.match(TAG_REGEX);
81+
82+
if (loadBodyTags) {
83+
const bodyTags = app.metadataCache.getFileCache(file)?.tags;
8584

8685
//Keep the tags array null if there are no tags in the frontmatter or body
87-
if (bodyTags !== null && bodyTags.length > 0) {
86+
if (bodyTags) {
8887
//Remove the hash from the tags
89-
const tagsWithoutHash = bodyTags.map((tag) => tag.slice(1));
88+
const tagsWithoutHash = bodyTags.map((t) => t.tag.slice(1));
9089
tags = Array.from(new Set([...(tags ?? []), ...tagsWithoutHash]));
9190
}
9291
}

test-vault/.obsidian/core-plugins-migration.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"canvas": true,
88
"outgoing-link": true,
99
"tag-pane": true,
10-
"properties": false,
10+
"properties": true,
1111
"page-preview": true,
1212
"daily-notes": false,
1313
"templates": false,

test-vault/.obsidian/core-plugins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"canvas",
88
"outgoing-link",
99
"tag-pane",
10+
"properties",
1011
"page-preview",
1112
"note-composer",
1213
"command-palette",

test-vault/.obsidian/plugins/vault-explorer/data.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"creationDate": "creation",
99
"modifiedDate": "modification",
1010
"createdDate": "creation",
11-
"image": "image"
11+
"image": "image",
12+
"coverImageFit": ""
1213
},
1314
"filters": {
1415
"search": {
@@ -60,7 +61,8 @@
6061
"type": "body",
6162
"isEnabled": true
6263
}
63-
]
64+
],
65+
"coverImageFit": "cover"
6466
},
6567
"list": {
6668
"isEnabled": true,
@@ -103,6 +105,6 @@
103105
"feed"
104106
],
105107
"configDir": ".vaultexplorer",
106-
"pluginVersion": "1.40.0",
108+
"pluginVersion": "1.41.0",
107109
"logLevel": "trace"
108110
}
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
---
22
tags:
3-
- tag1
4-
- tag2
5-
- tag3
3+
- tag1
4+
- tag2
5+
- tag3
66
---
7-
#tag4
7+
8+
#tag4
89

910
Some text #tag5
1011

1112
## Header
1213

1314
This is some text #tag6
1415

15-
#tag/subtag
16+
#tag/subtag
17+
18+
#1111

0 commit comments

Comments
 (0)