mirror of
https://github.com/decaf-dev/obsidian-vault-explorer.git
synced 2026-07-22 10:10:31 +00:00
commit
7dfd6197ed
25 changed files with 504 additions and 81 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "vault-explorer",
|
||||
"name": "Vault Explorer",
|
||||
"version": "1.44.6",
|
||||
"version": "1.45.0",
|
||||
"minAppVersion": "1.4.13",
|
||||
"description": "Explore your vault in visual format",
|
||||
"author": "DecafDev",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "obsidian-vault-explorer",
|
||||
"version": "1.44.6",
|
||||
"version": "1.45.0",
|
||||
"description": "Explore your vault in visual format",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ export const DEFAULT_SETTINGS: VaultExplorerPluginSettings = {
|
|||
isEnabled: false,
|
||||
},
|
||||
},
|
||||
confirmBeforeDelete: true,
|
||||
currentView: TExplorerView.GRID,
|
||||
titleWrapping: "normal",
|
||||
enableClockUpdates: true,
|
||||
|
|
@ -90,8 +91,8 @@ export const DEFAULT_SETTINGS: VaultExplorerPluginSettings = {
|
|||
viewOrder: [
|
||||
TExplorerView.GRID,
|
||||
TExplorerView.LIST,
|
||||
TExplorerView.TABLE,
|
||||
TExplorerView.FEED,
|
||||
TExplorerView.TABLE,
|
||||
],
|
||||
configDir: ".vaultexplorer",
|
||||
pluginVersion: null,
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import Migrate_1_39_0 from "./migrate_1_39_0";
|
|||
import Migrate_1_40_0 from "./migrate_1_40_0";
|
||||
import Migrate_1_41_0 from "./migrate_1_41_0";
|
||||
import Migrate_1_42_0 from "./migrate_1_42_0";
|
||||
import Migrate_1_45_0 from "./migrate_1_45_0";
|
||||
|
||||
const migrations: TMigration[] = [
|
||||
{
|
||||
|
|
@ -189,6 +190,11 @@ const migrations: TMigration[] = [
|
|||
to: "1.42.0",
|
||||
migrate: Migrate_1_42_0,
|
||||
},
|
||||
{
|
||||
from: "1.44.6",
|
||||
to: "1.45.0",
|
||||
migrate: Migrate_1_45_0,
|
||||
},
|
||||
];
|
||||
|
||||
export const preformMigrations = (
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { VaultExplorerPluginSettings } from "src/types";
|
||||
import MigrationInterface from "./migration_interface";
|
||||
import { VaultExplorerPluginSettings_1_40_2 } from "src/types/types-1.40.2";
|
||||
import { VaultExplorerPluginSettings_1_41_1 } from "src/types/types-1.41.1";
|
||||
|
||||
export default class Migrate_1_41_0 implements MigrationInterface {
|
||||
migrate(data: Record<string, unknown>) {
|
||||
const typedData = data as unknown as VaultExplorerPluginSettings_1_40_2;
|
||||
const newData: VaultExplorerPluginSettings = {
|
||||
const newData: VaultExplorerPluginSettings_1_41_1 = {
|
||||
...typedData,
|
||||
properties: {
|
||||
...typedData.properties,
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { VaultExplorerPluginSettings } from "src/types";
|
||||
import MigrationInterface from "./migration_interface";
|
||||
import { VaultExplorerPluginSettings_1_41_1 } from "src/types/types-1.41.1";
|
||||
import { VaultExplorerPluginSettings_1_44_6 } from "src/types/types-1.44.6";
|
||||
|
||||
export default class Migrate_1_42_0 implements MigrationInterface {
|
||||
migrate(data: Record<string, unknown>) {
|
||||
const typedData = data as unknown as VaultExplorerPluginSettings_1_41_1;
|
||||
const newData: VaultExplorerPluginSettings = {
|
||||
const newData: VaultExplorerPluginSettings_1_44_6 = {
|
||||
...typedData,
|
||||
properties: {
|
||||
...typedData.properties,
|
||||
|
|
|
|||
30
src/migrations/migrate_1_45_0.ts
Normal file
30
src/migrations/migrate_1_45_0.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { VaultExplorerPluginSettings_1_44_6 } from "src/types/types-1.44.6";
|
||||
import MigrationInterface from "./migration_interface";
|
||||
import { TExplorerView, VaultExplorerPluginSettings } from "src/types";
|
||||
|
||||
export default class Migrate_1_45_0 implements MigrationInterface {
|
||||
migrate(data: Record<string, unknown>) {
|
||||
const typedData = data as unknown as VaultExplorerPluginSettings_1_44_6;
|
||||
|
||||
let viewOrder = [];
|
||||
if (typedData.views.grid.isEnabled) {
|
||||
viewOrder.push(TExplorerView.GRID);
|
||||
}
|
||||
if (typedData.views.list.isEnabled) {
|
||||
viewOrder.push(TExplorerView.LIST);
|
||||
}
|
||||
if (typedData.views.feed.isEnabled) {
|
||||
viewOrder.push(TExplorerView.FEED);
|
||||
}
|
||||
if (typedData.views.table.isEnabled) {
|
||||
viewOrder.push(TExplorerView.TABLE);
|
||||
}
|
||||
|
||||
const newData: VaultExplorerPluginSettings = {
|
||||
...typedData,
|
||||
confirmBeforeDelete: true,
|
||||
viewOrder,
|
||||
};
|
||||
return newData as unknown as Record<string, unknown>;
|
||||
}
|
||||
}
|
||||
|
|
@ -46,10 +46,6 @@ export default class VaultExplorerSettingsTab extends PluginSettingTab {
|
|||
this.app,
|
||||
"datetime"
|
||||
);
|
||||
const checkboxProperties = getObsidianPropertiesByType(
|
||||
this.app,
|
||||
"checkbox"
|
||||
);
|
||||
|
||||
new Setting(containerEl).setName("General").setHeading();
|
||||
|
||||
|
|
@ -108,6 +104,20 @@ export default class VaultExplorerSettingsTab extends PluginSettingTab {
|
|||
})
|
||||
);
|
||||
|
||||
new Setting(containerEl).setName("Context menu").setHeading();
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName("Confirm before delete")
|
||||
.setDesc("Ask for confirmation before deleting a file.")
|
||||
.addToggle((toggle) =>
|
||||
toggle
|
||||
.setValue(this.plugin.settings.confirmBeforeDelete)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.confirmBeforeDelete = value;
|
||||
await this.plugin.saveSettings();
|
||||
})
|
||||
);
|
||||
|
||||
new Setting(containerEl).setName("Filters").setHeading();
|
||||
|
||||
new Setting(containerEl).setName("Search filter").addToggle((toggle) =>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts">
|
||||
import { createEventDispatcher, onMount } from "svelte";
|
||||
import { onMount } from "svelte";
|
||||
import { CollapseStyle } from "src/types";
|
||||
import EventManager from "src/event/event-manager";
|
||||
import VaultExplorerPlugin from "src/main";
|
||||
|
|
@ -35,6 +35,7 @@
|
|||
export let path: string;
|
||||
export let createdMillis: number;
|
||||
export let content: string | null;
|
||||
export let enablePremiumFeatures: boolean;
|
||||
|
||||
let ref: HTMLElement | null = null;
|
||||
let enableFileIcons = false;
|
||||
|
|
@ -45,8 +46,6 @@
|
|||
let collapseStyle: CollapseStyle = "no-new-lines";
|
||||
let currentLineClamp: number = lineClampLarge;
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
let plugin: VaultExplorerPlugin;
|
||||
store.plugin.subscribe((p) => {
|
||||
plugin = p;
|
||||
|
|
@ -147,7 +146,15 @@
|
|||
|
||||
function handleCardContextMenu(e: Event) {
|
||||
const nativeEvent = e as MouseEvent;
|
||||
openContextMenu(plugin, path, nativeEvent, {});
|
||||
const { app, settings } = plugin;
|
||||
openContextMenu(
|
||||
nativeEvent,
|
||||
path,
|
||||
app,
|
||||
settings,
|
||||
enablePremiumFeatures,
|
||||
{},
|
||||
);
|
||||
}
|
||||
|
||||
function handleCardMouseOver(e: MouseEvent) {
|
||||
|
|
|
|||
|
|
@ -1,23 +1,14 @@
|
|||
<script lang="ts">
|
||||
import PremiumLink from "src/svelte/shared/components/premium-link.svelte";
|
||||
import PremiumMessage from "src/svelte/shared/components/premium-message.svelte";
|
||||
import { FileRenderData } from "../types";
|
||||
import License from "src/svelte/shared/services/license";
|
||||
import FeedCard from "./feed-card.svelte";
|
||||
|
||||
export let hasValidLicenseKey = false;
|
||||
export let data: FileRenderData[] = [];
|
||||
export let startIndex;
|
||||
export let pageLength;
|
||||
export let enablePremiumFeatures: boolean;
|
||||
|
||||
let filteredItems: FileRenderData[] = [];
|
||||
|
||||
License.getInstance()
|
||||
.getHasValidKeyStore()
|
||||
.subscribe((hasValidKey) => {
|
||||
hasValidLicenseKey = hasValidKey;
|
||||
});
|
||||
|
||||
$: {
|
||||
if (startIndex < data.length) {
|
||||
filteredItems = Array.from({ length: pageLength }, (_, i) => {
|
||||
|
|
@ -31,22 +22,15 @@
|
|||
</script>
|
||||
|
||||
<div class="vault-explorer-feed-view">
|
||||
{#if !hasValidLicenseKey}
|
||||
<div>
|
||||
<PremiumMessage />
|
||||
<PremiumLink />
|
||||
</div>
|
||||
{/if}
|
||||
{#if hasValidLicenseKey}
|
||||
{#each filteredItems as fileRenderData (fileRenderData.id)}
|
||||
<FeedCard
|
||||
displayName={fileRenderData.displayName}
|
||||
extension={fileRenderData.extension}
|
||||
baseName={fileRenderData.baseName}
|
||||
path={fileRenderData.path}
|
||||
content={fileRenderData.content}
|
||||
createdMillis={fileRenderData.createdMillis}
|
||||
/>
|
||||
{/each}
|
||||
{/if}
|
||||
{#each filteredItems as fileRenderData (fileRenderData.id)}
|
||||
<FeedCard
|
||||
{enablePremiumFeatures}
|
||||
displayName={fileRenderData.displayName}
|
||||
extension={fileRenderData.extension}
|
||||
baseName={fileRenderData.baseName}
|
||||
path={fileRenderData.path}
|
||||
content={fileRenderData.content}
|
||||
createdMillis={fileRenderData.createdMillis}
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
export let custom2: string | null;
|
||||
export let custom3: string | null;
|
||||
export let coverImageFit: CoverImageFit;
|
||||
export let enablePremiumFeatures: boolean;
|
||||
|
||||
let plugin: VaultExplorerPlugin;
|
||||
let enableFileIcons: boolean = false;
|
||||
|
|
@ -108,12 +109,22 @@
|
|||
const nativeEvent = e as MouseEvent;
|
||||
|
||||
const showCoverImageOptions = path.endsWith(".md");
|
||||
openContextMenu(plugin, path, nativeEvent, {
|
||||
coverImageFit: showCoverImageOptions ? coverImageFit : undefined,
|
||||
onCoverImageFitChange: showCoverImageOptions
|
||||
? handleCoverImageFitChange
|
||||
: undefined,
|
||||
});
|
||||
const { app, settings } = plugin;
|
||||
openContextMenu(
|
||||
nativeEvent,
|
||||
path,
|
||||
app,
|
||||
settings,
|
||||
enablePremiumFeatures,
|
||||
{
|
||||
coverImageFit: showCoverImageOptions
|
||||
? coverImageFit
|
||||
: undefined,
|
||||
onCoverImageFitChange: showCoverImageOptions
|
||||
? handleCoverImageFitChange
|
||||
: undefined,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
function handleCardMouseOver(e: MouseEvent) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
export let data: FileRenderData[];
|
||||
export let startIndex: number;
|
||||
export let pageLength: number;
|
||||
export let enablePremiumFeatures: boolean;
|
||||
|
||||
let filteredItems: FileRenderData[] = [];
|
||||
|
||||
|
|
@ -24,6 +25,7 @@
|
|||
<div class="vault-explorer-grid-view__container">
|
||||
{#each filteredItems as fileRenderData (fileRenderData.id)}
|
||||
<GridCard
|
||||
{enablePremiumFeatures}
|
||||
displayName={fileRenderData.displayName}
|
||||
path={fileRenderData.path}
|
||||
coverImageFit={fileRenderData.coverImageFit}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
export let tags: string[] | null;
|
||||
export let showTags: boolean;
|
||||
export let isSmallScreenSize: boolean;
|
||||
export let enablePremiumFeatures: boolean;
|
||||
|
||||
let enableFileIcons: boolean = false;
|
||||
let ref: HTMLElement | null = null;
|
||||
|
|
@ -75,7 +76,15 @@
|
|||
|
||||
function handleItemContextMenu(e: Event) {
|
||||
const nativeEvent = e as MouseEvent;
|
||||
openContextMenu(plugin, path, nativeEvent, {});
|
||||
const { app, settings } = plugin;
|
||||
openContextMenu(
|
||||
nativeEvent,
|
||||
path,
|
||||
app,
|
||||
settings,
|
||||
enablePremiumFeatures,
|
||||
{},
|
||||
);
|
||||
}
|
||||
|
||||
function handleItemMouseOver(e: MouseEvent) {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
export let pageLength: number;
|
||||
export let showTags: boolean;
|
||||
export let isSmallScreenSize: boolean;
|
||||
export let enablePremiumFeatures: boolean;
|
||||
|
||||
let filteredItems: FileRenderData[] = [];
|
||||
|
||||
|
|
@ -26,6 +27,7 @@
|
|||
<div class="vault-explorer-list-view">
|
||||
{#each filteredItems as fileRenderData (fileRenderData.id)}
|
||||
<ListItem
|
||||
{enablePremiumFeatures}
|
||||
{showTags}
|
||||
displayName={fileRenderData.displayName}
|
||||
extension={fileRenderData.extension}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts">
|
||||
import { createEventDispatcher, onMount } from "svelte";
|
||||
import { onMount } from "svelte";
|
||||
import { openContextMenu } from "../services/context-menu";
|
||||
import { formatAsBearTimeString } from "../services/time-string";
|
||||
import { FileRenderData } from "../types";
|
||||
|
|
@ -25,6 +25,7 @@
|
|||
export let data: FileRenderData[];
|
||||
export let startIndex: number;
|
||||
export let pageLength: number;
|
||||
export let enablePremiumFeatures: boolean;
|
||||
|
||||
let filteredItems: FileRenderData[] = [];
|
||||
let plugin: VaultExplorerPlugin | null = null;
|
||||
|
|
@ -54,8 +55,6 @@
|
|||
},
|
||||
];
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
store.plugin.subscribe((p) => {
|
||||
plugin = p;
|
||||
enableFileIcons = plugin.settings.enableFileIcons;
|
||||
|
|
@ -103,7 +102,15 @@
|
|||
if (plugin === null) return;
|
||||
|
||||
const nativeEvent = e as MouseEvent;
|
||||
openContextMenu(plugin, path, nativeEvent, {});
|
||||
const { app, settings } = plugin;
|
||||
openContextMenu(
|
||||
nativeEvent,
|
||||
path,
|
||||
app,
|
||||
settings,
|
||||
enablePremiumFeatures,
|
||||
{},
|
||||
);
|
||||
}
|
||||
|
||||
function getValue(item: FileRenderData, column: TColumn): unknown {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
import Flex from "../shared/components/flex.svelte";
|
||||
import TabList from "../shared/components/tab-list.svelte";
|
||||
import Tab from "../shared/components/tab.svelte";
|
||||
import { Notice, TFile } from "obsidian";
|
||||
import { TFile } from "obsidian";
|
||||
import {
|
||||
TCustomFilter,
|
||||
TSearchFilter,
|
||||
|
|
@ -57,7 +57,7 @@
|
|||
} from "./services/favorites-store";
|
||||
import TableView from "./components/table-view.svelte";
|
||||
import Spacer from "../shared/components/spacer.svelte";
|
||||
import Divider from "../shared/components/divider.svelte";
|
||||
import License from "../shared/services/license";
|
||||
|
||||
// ============================================
|
||||
// Variables
|
||||
|
|
@ -104,10 +104,18 @@
|
|||
let viewOrder: TExplorerView[] = [];
|
||||
let showListViewTags: boolean = false;
|
||||
let isSmallScreenSize: boolean = false;
|
||||
let enablePremiumFeatures: boolean = false;
|
||||
|
||||
// ============================================
|
||||
// Lifecycle hooks
|
||||
// ============================================
|
||||
|
||||
License.getInstance()
|
||||
.getHasValidKeyStore()
|
||||
.subscribe((hasValidKey) => {
|
||||
enablePremiumFeatures = hasValidKey;
|
||||
});
|
||||
|
||||
randomFileSortStore.subscribe((value) => {
|
||||
randomSortCache = value;
|
||||
});
|
||||
|
|
@ -967,6 +975,7 @@
|
|||
data={renderData}
|
||||
{startIndex}
|
||||
{pageLength}
|
||||
{enablePremiumFeatures}
|
||||
on:coverImageFitChange={handleCoverImageFitChange}
|
||||
/>
|
||||
{:else if currentView === "list"}
|
||||
|
|
@ -976,11 +985,22 @@
|
|||
showTags={showListViewTags}
|
||||
{startIndex}
|
||||
{pageLength}
|
||||
{enablePremiumFeatures}
|
||||
/>
|
||||
{:else if currentView === "table"}
|
||||
<TableView data={renderData} {startIndex} {pageLength} />
|
||||
<TableView
|
||||
data={renderData}
|
||||
{startIndex}
|
||||
{pageLength}
|
||||
{enablePremiumFeatures}
|
||||
/>
|
||||
{:else if currentView === "feed"}
|
||||
<FeedView data={renderData} {startIndex} {pageLength} />
|
||||
<FeedView
|
||||
data={renderData}
|
||||
{startIndex}
|
||||
{pageLength}
|
||||
{enablePremiumFeatures}
|
||||
/>
|
||||
{/if}
|
||||
<PaginationIndicator
|
||||
{startIndex}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
import { Menu } from "obsidian";
|
||||
import VaultExplorerPlugin from "src/main";
|
||||
import { CoverImageFit } from "src/types";
|
||||
import { App, Menu, Notice } from "obsidian";
|
||||
import { CoverImageFit, VaultExplorerPluginSettings } from "src/types";
|
||||
|
||||
export const openContextMenu = (
|
||||
plugin: VaultExplorerPlugin,
|
||||
filePath: string,
|
||||
e: MouseEvent,
|
||||
filePath: string,
|
||||
app: App,
|
||||
settings: VaultExplorerPluginSettings,
|
||||
enablePremiumFeatures: boolean,
|
||||
{
|
||||
coverImageFit,
|
||||
onCoverImageFitChange,
|
||||
|
|
@ -17,19 +18,21 @@ export const openContextMenu = (
|
|||
) => void;
|
||||
}
|
||||
) => {
|
||||
const { confirmBeforeDelete } = settings;
|
||||
|
||||
const menu = new Menu();
|
||||
menu.setUseNativeMenu(true);
|
||||
menu.addItem((item) => {
|
||||
item.setTitle("Open in new tab");
|
||||
item.onClick(() => openInNewTab(plugin, filePath));
|
||||
item.onClick(() => openInNewTab(app, filePath));
|
||||
});
|
||||
menu.addItem((item) => {
|
||||
item.setTitle("Open to the right");
|
||||
item.onClick(() => openToTheRight(plugin, filePath));
|
||||
item.onClick(() => openToTheRight(app, filePath));
|
||||
});
|
||||
menu.addItem((item) => {
|
||||
item.setTitle("Open in new window");
|
||||
item.onClick(() => openInNewWindow(plugin, filePath));
|
||||
item.onClick(() => openInNewWindow(app, filePath));
|
||||
});
|
||||
if (coverImageFit !== undefined && onCoverImageFitChange !== undefined) {
|
||||
menu.addSeparator();
|
||||
|
|
@ -44,17 +47,43 @@ export const openContextMenu = (
|
|||
item.onClick(() => onCoverImageFitChange(filePath, "contain"));
|
||||
});
|
||||
}
|
||||
menu.addSeparator();
|
||||
menu.addItem((item) => {
|
||||
item.setTitle("Delete");
|
||||
item.onClick(async () => {
|
||||
if (!enablePremiumFeatures) {
|
||||
new Notice(
|
||||
"This feature requires a premium Vault Explorer license."
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (confirmBeforeDelete) {
|
||||
if (confirm("Are you sure you want to delete this file?")) {
|
||||
await deleteFile(app, filePath);
|
||||
}
|
||||
} else {
|
||||
await deleteFile(app, filePath);
|
||||
}
|
||||
});
|
||||
});
|
||||
menu.showAtMouseEvent(e);
|
||||
};
|
||||
|
||||
const openToTheRight = (plugin: VaultExplorerPlugin, filePath: string) => {
|
||||
plugin.app.workspace.openLinkText("", filePath, "split", {
|
||||
const deleteFile = async (app: App, filePath: string) => {
|
||||
const file = app.vault.getAbstractFileByPath(filePath);
|
||||
if (!file) return;
|
||||
|
||||
return app.vault.delete(file);
|
||||
};
|
||||
|
||||
const openToTheRight = (app: App, filePath: string) => {
|
||||
app.workspace.openLinkText("", filePath, "split", {
|
||||
active: false,
|
||||
});
|
||||
};
|
||||
|
||||
const openInNewTab = (plugin: VaultExplorerPlugin, filePath: string) => {
|
||||
plugin.app.workspace.getLeaf().setViewState({
|
||||
const openInNewTab = (app: App, filePath: string) => {
|
||||
app.workspace.getLeaf().setViewState({
|
||||
type: "markdown",
|
||||
active: false,
|
||||
state: {
|
||||
|
|
@ -63,6 +92,6 @@ const openInNewTab = (plugin: VaultExplorerPlugin, filePath: string) => {
|
|||
});
|
||||
};
|
||||
|
||||
const openInNewWindow = (plugin: VaultExplorerPlugin, filePath: string) => {
|
||||
plugin.app.workspace.openLinkText("", filePath, "window");
|
||||
const openInNewWindow = (app: App, filePath: string) => {
|
||||
app.workspace.openLinkText("", filePath, "window");
|
||||
};
|
||||
|
|
|
|||
|
|
@ -622,6 +622,7 @@ export function isVaultExplorerPluginSettings(obj: unknown): obj is VaultExplore
|
|||
typeof typedObj["views"]["related"] === "object" ||
|
||||
typeof typedObj["views"]["related"] === "function") &&
|
||||
typeof typedObj["views"]["related"]["isEnabled"] === "boolean" &&
|
||||
typeof typedObj["confirmBeforeDelete"] === "boolean" &&
|
||||
(typedObj["titleWrapping"] === "normal" ||
|
||||
typedObj["titleWrapping"] === "break-word") &&
|
||||
typeof typedObj["enableClockUpdates"] === "boolean" &&
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ export interface VaultExplorerPluginSettings {
|
|||
recommended: TRecommendedView;
|
||||
related: TRelatedView;
|
||||
};
|
||||
confirmBeforeDelete: boolean;
|
||||
titleWrapping: WordBreak;
|
||||
enableClockUpdates: boolean;
|
||||
enableFileIcons: boolean;
|
||||
|
|
|
|||
|
|
@ -39,8 +39,6 @@ export interface VaultExplorerPluginSettings_1_36_3 {
|
|||
logLevel: string;
|
||||
}
|
||||
|
||||
type FileInteractionStyle = "title" | "content";
|
||||
|
||||
interface BaseView {
|
||||
isEnabled: boolean;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,8 +39,6 @@ export interface VaultExplorerPluginSettings_1_38_0 {
|
|||
logLevel: string;
|
||||
}
|
||||
|
||||
type FileInteractionStyle = "title" | "content";
|
||||
|
||||
interface BaseView {
|
||||
isEnabled: boolean;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,8 +40,6 @@ export interface VaultExplorerPluginSettings_1_40_2 {
|
|||
logLevel: string;
|
||||
}
|
||||
|
||||
type FileInteractionStyle = "title" | "content";
|
||||
|
||||
interface BaseView {
|
||||
isEnabled: boolean;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,8 +41,6 @@ export interface VaultExplorerPluginSettings_1_41_1 {
|
|||
logLevel: string;
|
||||
}
|
||||
|
||||
type FileInteractionStyle = "title" | "content";
|
||||
|
||||
interface BaseView {
|
||||
isEnabled: boolean;
|
||||
}
|
||||
|
|
|
|||
310
src/types/types-1.44.6.ts
Normal file
310
src/types/types-1.44.6.ts
Normal file
|
|
@ -0,0 +1,310 @@
|
|||
export interface VaultExplorerPluginSettings_1_44_6 {
|
||||
properties: {
|
||||
url: string;
|
||||
image: string;
|
||||
coverImageFit: string;
|
||||
createdDate: string;
|
||||
modifiedDate: string;
|
||||
custom1: string;
|
||||
custom2: string;
|
||||
custom3: string;
|
||||
};
|
||||
filters: {
|
||||
search: TSearchFilter;
|
||||
sort: TSortFilter;
|
||||
custom: TCustomFilter;
|
||||
};
|
||||
views: {
|
||||
dashboard: TDashboardView;
|
||||
grid: TGridView;
|
||||
list: TListView;
|
||||
table: TTableView;
|
||||
feed: TFeedView;
|
||||
recommended: TRecommendedView;
|
||||
related: TRelatedView;
|
||||
};
|
||||
titleWrapping: WordBreak;
|
||||
enableClockUpdates: boolean;
|
||||
enableFileIcons: boolean;
|
||||
loadBodyTags: boolean;
|
||||
currentView: TExplorerView | null;
|
||||
pageSize: number;
|
||||
shouldCollapseFilters: boolean;
|
||||
viewOrder: TExplorerView[];
|
||||
configDir: string;
|
||||
pluginVersion: string | null;
|
||||
logLevel: string;
|
||||
}
|
||||
|
||||
interface BaseView {
|
||||
isEnabled: boolean;
|
||||
}
|
||||
|
||||
interface TTableView extends BaseView {}
|
||||
|
||||
interface TListView extends BaseView {
|
||||
showTags: boolean;
|
||||
}
|
||||
|
||||
interface TGridView extends BaseView {
|
||||
coverImageSources: CoverImageSource[];
|
||||
coverImageFit: CoverImageFit;
|
||||
loadSocialMediaImage: boolean;
|
||||
}
|
||||
|
||||
interface CoverImageSource {
|
||||
type: CoverImageSourceType;
|
||||
isEnabled: boolean;
|
||||
}
|
||||
|
||||
type CoverImageFit = "cover" | "contain";
|
||||
|
||||
type CoverImageSourceType =
|
||||
| "image-property"
|
||||
| "url-property"
|
||||
| "frontmatter"
|
||||
| "body";
|
||||
|
||||
interface TDashboardView extends BaseView {}
|
||||
|
||||
type CollapseStyle = "no-new-lines" | "no-extra-new-lines";
|
||||
|
||||
interface TFeedView extends BaseView {
|
||||
collapseStyle: CollapseStyle;
|
||||
removeH1: boolean;
|
||||
lineClampSmall: number;
|
||||
lineClampMedium: number;
|
||||
lineClampLarge: number;
|
||||
}
|
||||
|
||||
interface TRecommendedView extends BaseView {}
|
||||
|
||||
interface TRelatedView extends BaseView {}
|
||||
|
||||
interface BaseFilter {
|
||||
isEnabled: boolean;
|
||||
}
|
||||
|
||||
interface TSearchFilter extends BaseFilter {
|
||||
value: string;
|
||||
}
|
||||
|
||||
interface TSortFilter extends BaseFilter {
|
||||
value: SortFilterOption;
|
||||
}
|
||||
|
||||
interface TCustomFilter extends BaseFilter {
|
||||
selectedGroupId: string;
|
||||
groups: TFilterGroup[];
|
||||
}
|
||||
|
||||
type SortFilterOption =
|
||||
| "file-name-asc"
|
||||
| "file-name-desc"
|
||||
| "modified-asc"
|
||||
| "modified-desc"
|
||||
| "created-asc"
|
||||
| "created-desc"
|
||||
| "random";
|
||||
|
||||
type WordBreak = "normal" | "break-word";
|
||||
|
||||
enum TExplorerView {
|
||||
DASHBOARD = "dashboard",
|
||||
GRID = "grid",
|
||||
LIST = "list",
|
||||
FEED = "feed",
|
||||
TABLE = "table",
|
||||
RECOMMENDED = "recommended",
|
||||
RELATED = "related",
|
||||
}
|
||||
|
||||
type FilterOperator = "and" | "or";
|
||||
|
||||
enum TextFilterCondition {
|
||||
IS = "is",
|
||||
IS_NOT = "is-not",
|
||||
CONTAINS = "contains",
|
||||
DOES_NOT_CONTAIN = "does-not-contain",
|
||||
STARTS_WITH = "starts-with",
|
||||
ENDS_WITH = "ends-with",
|
||||
EXISTS = "exists",
|
||||
DOES_NOT_EXIST = "does-not-exist",
|
||||
}
|
||||
|
||||
enum ListFilterCondition {
|
||||
CONTAINS = "contains",
|
||||
DOES_NOT_CONTAIN = "does-not-contain",
|
||||
EXISTS = "exists",
|
||||
DOES_NOT_EXIST = "does-not-exist",
|
||||
}
|
||||
|
||||
enum NumberFilterCondition {
|
||||
IS_EQUAL = "is-equal",
|
||||
IS_NOT_EQUAL = "is-not-equal",
|
||||
IS_GREATER = "is-greater",
|
||||
IS_LESS = "is-less",
|
||||
IS_GREATER_OR_EQUAL = "is-greater-or-equal",
|
||||
IS_LESS_OR_EQUAL = "is-less-or-equal",
|
||||
EXISTS = "exists",
|
||||
DOES_NOT_EXIST = "does-not-exist",
|
||||
}
|
||||
|
||||
enum CheckboxFilterCondition {
|
||||
IS = "is",
|
||||
IS_NOT = "is-not",
|
||||
EXISTS = "exists",
|
||||
DOES_NOT_EXIST = "does-not-exist",
|
||||
}
|
||||
|
||||
enum DateFilterCondition {
|
||||
IS = "is",
|
||||
IS_BEFORE = "is-before",
|
||||
IS_AFTER = "is-after",
|
||||
IS_ON_OR_BEFORE = "is-on-or-before",
|
||||
IS_ON_OR_AFTER = "is-on-or-after",
|
||||
EXISTS = "exists",
|
||||
DOES_NOT_EXIST = "does-not-exist",
|
||||
}
|
||||
|
||||
enum ContentFilterCondition {
|
||||
CONTAINS = "contains",
|
||||
DOES_NOT_CONTAIN = "does-not-contain",
|
||||
IS_EMPTY = "is-empty",
|
||||
IS_NOT_EMPTY = "is-not-empty",
|
||||
}
|
||||
|
||||
enum FolderFilterCondition {
|
||||
IS = "is",
|
||||
IS_NOT = "is-not",
|
||||
}
|
||||
|
||||
enum FileNameFilterCondition {
|
||||
IS = "is",
|
||||
IS_NOT = "is-not",
|
||||
CONTAINS = "contains",
|
||||
DOES_NOT_CONTAIN = "does-not-contain",
|
||||
STARTS_WITH = "starts-with",
|
||||
ENDS_WITH = "ends-with",
|
||||
}
|
||||
|
||||
type FilterCondition =
|
||||
| TextFilterCondition
|
||||
| NumberFilterCondition
|
||||
| DateFilterCondition
|
||||
| CheckboxFilterCondition
|
||||
| ListFilterCondition
|
||||
| ContentFilterCondition
|
||||
| FolderFilterCondition
|
||||
| FileNameFilterCondition;
|
||||
|
||||
//This matches the Obsidian property types
|
||||
enum PropertyType {
|
||||
TEXT = "text",
|
||||
NUMBER = "number",
|
||||
LIST = "list",
|
||||
CHECKBOX = "checkbox",
|
||||
DATE = "date",
|
||||
DATETIME = "datetime",
|
||||
}
|
||||
|
||||
enum FilterRuleType {
|
||||
PROPERTY = "property",
|
||||
FOLDER = "folder",
|
||||
FILE_NAME = "file-name",
|
||||
CONTENT = "content",
|
||||
}
|
||||
|
||||
enum DatePropertyFilterValue {
|
||||
TODAY = "today",
|
||||
TOMORROW = "tomorrow",
|
||||
YESTERDAY = "yesterday",
|
||||
ONE_WEEK_FROM_NOW = "one-week-from-now",
|
||||
ONE_WEEK_AGO = "one-week-ago",
|
||||
ONE_MONTH_FROM_NOW = "one-month-from-now",
|
||||
ONE_MONTH_AGO = "one-month-ago",
|
||||
CUSTOM = "custom",
|
||||
}
|
||||
|
||||
interface BaseFilterRule {
|
||||
id: string;
|
||||
operator: FilterOperator;
|
||||
type: FilterRuleType;
|
||||
condition: FilterCondition;
|
||||
isEnabled: boolean;
|
||||
value: string;
|
||||
matchWhenPropertyDNE: boolean;
|
||||
}
|
||||
|
||||
interface TextPropertyFilterRule extends BaseFilterRule {
|
||||
type: FilterRuleType.PROPERTY;
|
||||
propertyType: PropertyType.TEXT;
|
||||
propertyName: string;
|
||||
condition: TextFilterCondition;
|
||||
}
|
||||
|
||||
interface NumberPropertyFilterRule extends BaseFilterRule {
|
||||
type: FilterRuleType.PROPERTY;
|
||||
propertyType: PropertyType.NUMBER;
|
||||
propertyName: string;
|
||||
condition: NumberFilterCondition;
|
||||
}
|
||||
|
||||
interface ListPropertyFilterRule extends BaseFilterRule {
|
||||
type: FilterRuleType.PROPERTY;
|
||||
propertyType: PropertyType.LIST;
|
||||
propertyName: string;
|
||||
condition: ListFilterCondition;
|
||||
}
|
||||
|
||||
interface CheckboxPropertyFilterRule extends BaseFilterRule {
|
||||
type: FilterRuleType.PROPERTY;
|
||||
propertyType: PropertyType.CHECKBOX;
|
||||
propertyName: string;
|
||||
condition: CheckboxFilterCondition;
|
||||
}
|
||||
|
||||
interface DatePropertyFilterRule extends BaseFilterRule {
|
||||
type: FilterRuleType.PROPERTY;
|
||||
propertyType: PropertyType.DATE | PropertyType.DATETIME;
|
||||
propertyName: string;
|
||||
condition: DateFilterCondition;
|
||||
valueData: string;
|
||||
}
|
||||
|
||||
interface FolderFilterRule extends BaseFilterRule {
|
||||
type: FilterRuleType.FOLDER;
|
||||
condition: FolderFilterCondition;
|
||||
includeSubfolders: boolean;
|
||||
}
|
||||
|
||||
interface FileNameFilterRule extends BaseFilterRule {
|
||||
type: FilterRuleType.FILE_NAME;
|
||||
condition: FileNameFilterCondition;
|
||||
}
|
||||
|
||||
interface ContentFilterRule extends BaseFilterRule {
|
||||
type: FilterRuleType.CONTENT;
|
||||
condition: ContentFilterCondition;
|
||||
}
|
||||
|
||||
type TFilterRule =
|
||||
| PropertyFilterRule
|
||||
| FolderFilterRule
|
||||
| FileNameFilterRule
|
||||
| ContentFilterRule;
|
||||
|
||||
type PropertyFilterRule =
|
||||
| TextPropertyFilterRule
|
||||
| NumberPropertyFilterRule
|
||||
| ListPropertyFilterRule
|
||||
| CheckboxPropertyFilterRule
|
||||
| DatePropertyFilterRule;
|
||||
|
||||
interface TFilterGroup {
|
||||
id: string;
|
||||
name: string;
|
||||
rules: TFilterRule[];
|
||||
isEnabled: boolean;
|
||||
isSticky: boolean;
|
||||
}
|
||||
|
|
@ -147,5 +147,6 @@
|
|||
"1.44.3": "1.4.13",
|
||||
"1.44.4": "1.4.13",
|
||||
"1.44.5": "1.4.13",
|
||||
"1.44.6": "1.4.13"
|
||||
"1.44.6": "1.4.13",
|
||||
"1.45.0": "1.4.13"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue