FFLOW 0.1.0: trigger symbols set frontmatter properties
This commit is contained in:
commit
021777203b
15 files changed
+1189
No files matched your search
+28
@@ -0,0 +1,28 @@
|
||||
import { Plugin } from "obsidian";
|
||||
import { DEFAULT_SETTINGS, FflowSettings } from "./settings";
|
||||
import { FflowSettingTab } from "./settings-tab";
|
||||
import { TriggerSuggest, ValueIndex } from "./suggest";
|
||||
|
||||
export default class FflowPlugin extends Plugin {
|
||||
settings!: FflowSettings;
|
||||
|
||||
async onload(): Promise<void> {
|
||||
await this.loadSettings();
|
||||
|
||||
const index = new ValueIndex(this.app);
|
||||
this.registerEvent(this.app.metadataCache.on("changed", () => index.invalidate()));
|
||||
this.registerEvent(this.app.metadataCache.on("deleted", () => index.invalidate()));
|
||||
|
||||
this.registerEditorSuggest(new TriggerSuggest(this.app, this, index));
|
||||
this.addSettingTab(new FflowSettingTab(this.app, this));
|
||||
}
|
||||
|
||||
async loadSettings(): Promise<void> {
|
||||
const saved = (await this.loadData()) as Partial<FflowSettings> | null;
|
||||
this.settings = { ...DEFAULT_SETTINGS, ...saved };
|
||||
}
|
||||
|
||||
async saveSettings(): Promise<void> {
|
||||
await this.saveData(this.settings);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user