FFLOW 0.2.0: flows with next/previous commands and per-step cssclasses; grouped settings page

This commit is contained in:
olivier committed 2026-10-25 17:54:31 -04:00
1 parent 021777203b
commit 68e390fb37
12 files changed
+486 -165

No files matched your search

+11 -3
View File
@@ -1,10 +1,12 @@
import { Plugin } from "obsidian";
import { DEFAULT_SETTINGS, FflowSettings } from "./settings";
import { FlowCommands } from "./flows";
import { DEFAULT_SETTINGS, FflowSettings, NEW_RULE } from "./settings";
import { FflowSettingTab } from "./settings-tab";
import { TriggerSuggest, ValueIndex } from "./suggest";
export default class FflowPlugin extends Plugin {
settings!: FflowSettings;
private flowCommands = new FlowCommands(this);
async onload(): Promise<void> {
await this.loadSettings();
@@ -14,15 +16,21 @@ export default class FflowPlugin extends Plugin {
this.registerEvent(this.app.metadataCache.on("deleted", () => index.invalidate()));
this.registerEditorSuggest(new TriggerSuggest(this.app, this, index));
this.flowCommands.sync();
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 };
const saved = ((await this.loadData()) ?? {}) as Partial<FflowSettings>;
this.settings = {
// Fill fields added after a rule was saved (e.g. flowId in 0.2.0).
rules: (saved.rules ?? DEFAULT_SETTINGS.rules).map((r) => ({ ...NEW_RULE, ...r })),
flows: saved.flows ?? [],
};
}
async saveSettings(): Promise<void> {
await this.saveData(this.settings);
this.flowCommands.sync();
}
}