mirror of
https://github.com/decaf-dev/obsidian-vault-explorer.git
synced 2026-07-22 10:10:31 +00:00
commit
a286ffd1c2
11 changed files with 110 additions and 43 deletions
20
.github/workflows/check-console-log.yml
vendored
Normal file
20
.github/workflows/check-console-log.yml
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
name: Check Console Log
|
||||
|
||||
on: pull_request
|
||||
|
||||
jobs:
|
||||
check_console_log:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Run console.log check
|
||||
run: |
|
||||
found=$(find src/ -type f ! -name "main.ts" ! -path "*/migrations/index.ts" | xargs grep "console.log" || true)
|
||||
if [ -n "$found" ]; then
|
||||
echo "console.log found in the following files:"
|
||||
echo "$found"
|
||||
exit 1
|
||||
fi
|
||||
echo "No console.log statements found!"
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "vault-explorer",
|
||||
"name": "Vault Explorer",
|
||||
"version": "1.41.0",
|
||||
"version": "1.41.1",
|
||||
"minAppVersion": "1.4.13",
|
||||
"description": "Explore your vault in visual format",
|
||||
"author": "DecafDev",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "obsidian-vault-explorer",
|
||||
"version": "1.41.0",
|
||||
"version": "1.41.1",
|
||||
"description": "Explore your vault in visual format",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { App, PluginSettingTab, Setting } from "obsidian";
|
||||
import { App, PluginSettingTab, Setting, SliderComponent } from "obsidian";
|
||||
import VaultExplorerPlugin from "src/main";
|
||||
import {
|
||||
getDropdownOptionsForProperties,
|
||||
|
|
@ -386,59 +386,107 @@ export default class VaultExplorerSettingsTab extends PluginSettingTab {
|
|||
})
|
||||
);
|
||||
|
||||
let largeScreenLineClampSlider: SliderComponent | null = null;
|
||||
new Setting(containerEl)
|
||||
.setName("Large screen line clamp")
|
||||
.setDesc(
|
||||
"Number of lines to clamp on large screens (>= 1024px). (2-8, default 5)"
|
||||
"Number of lines to clamp on large screens (>= 1024px) (2-8, default 5)"
|
||||
)
|
||||
.addSlider((component) =>
|
||||
component
|
||||
.addExtraButton((button) =>
|
||||
button
|
||||
.setIcon("reset")
|
||||
.setTooltip("Restore default")
|
||||
.onClick(async () => {
|
||||
this.plugin.settings.views.feed.lineClampLarge = 5;
|
||||
largeScreenLineClampSlider?.setValue(5);
|
||||
await this.plugin.saveSettings();
|
||||
EventManager.getInstance().emit(
|
||||
PluginEvent.FEED_CONTENT_SETTING_CHANGE
|
||||
);
|
||||
})
|
||||
)
|
||||
.addSlider((component) => {
|
||||
largeScreenLineClampSlider = component;
|
||||
return component
|
||||
.setValue(this.plugin.settings.views.feed.lineClampLarge)
|
||||
.setLimits(2, 8, 1)
|
||||
.setDynamicTooltip()
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.views.feed.lineClampLarge = value;
|
||||
await this.plugin.saveSettings();
|
||||
EventManager.getInstance().emit(
|
||||
PluginEvent.FEED_CONTENT_SETTING_CHANGE
|
||||
);
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
let mediumScreenLineClampSlider: SliderComponent | null = null;
|
||||
new Setting(containerEl)
|
||||
.setName("Medium screen line clamp")
|
||||
.setDesc(
|
||||
"Number of lines to clamp on medium screens (>= 600px and < 1024px). (2-8, default 3)"
|
||||
"Number of lines to clamp on medium screens (>= 600px and < 1024px) (2-8, default 3)"
|
||||
)
|
||||
.addSlider((component) =>
|
||||
component
|
||||
.addExtraButton((button) =>
|
||||
button
|
||||
.setIcon("reset")
|
||||
.setTooltip("Restore default")
|
||||
.onClick(async () => {
|
||||
this.plugin.settings.views.feed.lineClampLarge = 3;
|
||||
mediumScreenLineClampSlider?.setValue(3);
|
||||
await this.plugin.saveSettings();
|
||||
EventManager.getInstance().emit(
|
||||
PluginEvent.FEED_CONTENT_SETTING_CHANGE
|
||||
);
|
||||
})
|
||||
)
|
||||
.addSlider((component) => {
|
||||
mediumScreenLineClampSlider = component;
|
||||
return component
|
||||
.setValue(this.plugin.settings.views.feed.lineClampMedium)
|
||||
.setLimits(2, 8, 1)
|
||||
.setDynamicTooltip()
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.views.feed.lineClampMedium = value;
|
||||
await this.plugin.saveSettings();
|
||||
EventManager.getInstance().emit(
|
||||
PluginEvent.FEED_CONTENT_SETTING_CHANGE
|
||||
);
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
let smallScreenLineClampSlider: SliderComponent | null = null;
|
||||
new Setting(containerEl)
|
||||
.setName("Small screen line clamp")
|
||||
.setDesc(
|
||||
"Number of lines to clamp on small screens (< 600px). (2-8, default 2)"
|
||||
"Number of lines to clamp on small screens (< 600px) (2-8, default 2)"
|
||||
)
|
||||
.addSlider((component) =>
|
||||
component
|
||||
.addExtraButton((button) =>
|
||||
button
|
||||
.setIcon("reset")
|
||||
.setTooltip("Restore default")
|
||||
.onClick(async () => {
|
||||
this.plugin.settings.views.feed.lineClampLarge = 2;
|
||||
smallScreenLineClampSlider?.setValue(2);
|
||||
await this.plugin.saveSettings();
|
||||
EventManager.getInstance().emit(
|
||||
PluginEvent.FEED_CONTENT_SETTING_CHANGE
|
||||
);
|
||||
})
|
||||
)
|
||||
.addSlider((component) => {
|
||||
smallScreenLineClampSlider = component;
|
||||
return component
|
||||
.setValue(this.plugin.settings.views.feed.lineClampSmall)
|
||||
.setLimits(2, 8, 1)
|
||||
.setDynamicTooltip()
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.views.feed.lineClampSmall = value;
|
||||
await this.plugin.saveSettings();
|
||||
EventManager.getInstance().emit(
|
||||
PluginEvent.FEED_CONTENT_SETTING_CHANGE
|
||||
);
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
new Setting(containerEl).setName("Built-in properties").setHeading();
|
||||
|
||||
|
|
|
|||
|
|
@ -790,8 +790,6 @@
|
|||
value: CoverImageFit;
|
||||
};
|
||||
|
||||
console.log(filePath, value);
|
||||
|
||||
const { properties } = plugin.settings;
|
||||
const { coverImageFit: coverImageFitProperty } = properties;
|
||||
|
||||
|
|
@ -897,11 +895,7 @@
|
|||
) {
|
||||
formatted = filteredCustom.map((loadedFile) => {
|
||||
const { id, file } = loadedFile;
|
||||
const frontmatter =
|
||||
plugin.app.metadataCache.getFileCache(file)?.frontmatter;
|
||||
|
||||
const isFavorite = favoritesCache.get(file.path) ?? null;
|
||||
|
||||
const content = contentCache.get(file.path) ?? null;
|
||||
|
||||
return formatFileDataForRender({
|
||||
|
|
@ -909,7 +903,6 @@
|
|||
settings: plugin.settings,
|
||||
fileId: id,
|
||||
file,
|
||||
fileFrontmatter: frontmatter,
|
||||
fileContent: content,
|
||||
fileFavorite: isFavorite,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ export const formatFileDataForRender = ({
|
|||
settings,
|
||||
file,
|
||||
fileId,
|
||||
fileFrontmatter,
|
||||
fileContent,
|
||||
fileFavorite,
|
||||
}: {
|
||||
|
|
@ -53,12 +52,13 @@ export const formatFileDataForRender = ({
|
|||
settings: VaultExplorerPluginSettings;
|
||||
file: TFile;
|
||||
fileId: string;
|
||||
fileFrontmatter: FrontMatterCache | undefined;
|
||||
fileContent: string | null;
|
||||
fileFavorite: boolean | null;
|
||||
}): FileRenderData => {
|
||||
const { name, basename, extension, path } = file;
|
||||
|
||||
const fileFrontmatter = app.metadataCache.getFileCache(file)?.frontmatter;
|
||||
|
||||
const { loadBodyTags } = settings;
|
||||
const { coverImageSources } = settings.views.grid;
|
||||
const {
|
||||
|
|
@ -78,15 +78,14 @@ export const formatFileDataForRender = ({
|
|||
"tags",
|
||||
PropertyType.LIST
|
||||
);
|
||||
if (fileContent && loadBodyTags) {
|
||||
const body = removeFrontmatter(fileContent);
|
||||
const TAG_REGEX = /#\w+(\/\w+)*/g;
|
||||
const bodyTags = body.match(TAG_REGEX);
|
||||
|
||||
if (loadBodyTags) {
|
||||
const bodyTags = app.metadataCache.getFileCache(file)?.tags;
|
||||
|
||||
//Keep the tags array null if there are no tags in the frontmatter or body
|
||||
if (bodyTags !== null && bodyTags.length > 0) {
|
||||
if (bodyTags) {
|
||||
//Remove the hash from the tags
|
||||
const tagsWithoutHash = bodyTags.map((tag) => tag.slice(1));
|
||||
const tagsWithoutHash = bodyTags.map((t) => t.tag.slice(1));
|
||||
tags = Array.from(new Set([...(tags ?? []), ...tagsWithoutHash]));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
"canvas": true,
|
||||
"outgoing-link": true,
|
||||
"tag-pane": true,
|
||||
"properties": false,
|
||||
"properties": true,
|
||||
"page-preview": true,
|
||||
"daily-notes": false,
|
||||
"templates": false,
|
||||
|
|
|
|||
1
test-vault/.obsidian/core-plugins.json
vendored
1
test-vault/.obsidian/core-plugins.json
vendored
|
|
@ -7,6 +7,7 @@
|
|||
"canvas",
|
||||
"outgoing-link",
|
||||
"tag-pane",
|
||||
"properties",
|
||||
"page-preview",
|
||||
"note-composer",
|
||||
"command-palette",
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@
|
|||
"creationDate": "creation",
|
||||
"modifiedDate": "modification",
|
||||
"createdDate": "creation",
|
||||
"image": "image"
|
||||
"image": "image",
|
||||
"coverImageFit": ""
|
||||
},
|
||||
"filters": {
|
||||
"search": {
|
||||
|
|
@ -60,7 +61,8 @@
|
|||
"type": "body",
|
||||
"isEnabled": true
|
||||
}
|
||||
]
|
||||
],
|
||||
"coverImageFit": "cover"
|
||||
},
|
||||
"list": {
|
||||
"isEnabled": true,
|
||||
|
|
@ -103,6 +105,6 @@
|
|||
"feed"
|
||||
],
|
||||
"configDir": ".vaultexplorer",
|
||||
"pluginVersion": "1.40.0",
|
||||
"pluginVersion": "1.41.0",
|
||||
"logLevel": "trace"
|
||||
}
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
---
|
||||
tags:
|
||||
- tag1
|
||||
- tag2
|
||||
- tag3
|
||||
- tag1
|
||||
- tag2
|
||||
- tag3
|
||||
---
|
||||
#tag4
|
||||
|
||||
#tag4
|
||||
|
||||
Some text #tag5
|
||||
|
||||
|
|
@ -12,4 +13,6 @@ Some text #tag5
|
|||
|
||||
This is some text #tag6
|
||||
|
||||
#tag/subtag
|
||||
#tag/subtag
|
||||
|
||||
#1111
|
||||
|
|
|
|||
|
|
@ -135,5 +135,6 @@
|
|||
"1.40.0": "1.4.13",
|
||||
"1.40.1": "1.4.13",
|
||||
"1.40.2": "1.4.13",
|
||||
"1.41.0": "1.4.13"
|
||||
"1.41.0": "1.4.13",
|
||||
"1.41.1": "1.4.13"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue