feat: save plugin version

This commit is contained in:
Trey Wallis 2024-04-21 20:53:54 -06:00
parent a8e066aace
commit ec2bc8b7cd
3 changed files with 14 additions and 5 deletions

View file

@ -33,5 +33,6 @@ export const DEFAULT_SETTINGS: VaultExplorerPluginSettings = {
}
},
currentView: "grid",
pageSize: 50
pageSize: 50,
pluginVersion: null
}

View file

@ -95,7 +95,14 @@ export default class VaultExplorerPlugin extends Plugin {
async loadSettings() {
const data = await this.loadData();
this.settings = Object.assign({}, DEFAULT_SETTINGS, data);
//TODO handle migrations
// if (this.settings.pluginVersion === null) {
this.settings.pluginVersion = this.manifest.version;
await this.saveSettings();
// }
}
async saveSettings() {

View file

@ -19,6 +19,11 @@ export interface VaultExplorerPluginSettings {
},
currentView: CurrentView;
pageSize: number;
pluginVersion: string | null;
}
export interface CustomProperty {
name: string;
}
export interface TextPropertyFilter extends BasePropertyFilter {
@ -63,7 +68,3 @@ export type CurrentView = "grid" | "list";
export type SortFilter = "file-name-asc" | "file-name-desc" | "modified-asc" | "modified-desc";
export type TimestampFilter = "created-today" | "modified-today" | "created-this-week" | "modified-this-week" | "created-2-weeks" | "modified-2-weeks" | "all";
export type onSettingsChange = (value: VaultExplorerPluginSettings) => void;
export type getCurrentSettings = () => VaultExplorerPluginSettings;