diff --git a/Settings/Settings.ts b/Settings/Settings.ts new file mode 100644 index 0000000..91ce820 --- /dev/null +++ b/Settings/Settings.ts @@ -0,0 +1,19 @@ +import AutoMoverPlugin from "main"; + +export interface AutoMoverSettings { + moveOnOpen: boolean, + moveOnSave: boolean, + moveOnClose: boolean, + moveOnCreate: boolean, +} + +export const DEFAULT_SETTINGS: Partial = { + moveOnOpen: true, + moveOnSave: true, + moveOnClose: false, + moveOnCreate: false, +} + +function loadSettings(AutoMoverPlugin: AutoMoverPlugin): Partial { + return Object.assign({}, DEFAULT_SETTINGS, AutoMoverPlugin.loadData()); +} \ No newline at end of file diff --git a/bun.lockb b/bun.lockb new file mode 100755 index 0000000..382aa86 Binary files /dev/null and b/bun.lockb differ diff --git a/main.ts b/main.ts index b99269e..855399e 100644 --- a/main.ts +++ b/main.ts @@ -1,13 +1,18 @@ import { Plugin } from "obsidian"; +import { AutoMoverSettings, DEFAULT_SETTINGS } from "Settings/Settings"; import movingUtil from "Utils/MovingUtil"; export default class AutoMoverPlugin extends Plugin { + settings: AutoMoverSettings; + async onload() { console.log('loading plugin') - movingUtil.init(this.app); - console.log(movingUtil.isFile("Untitled.md")); - console.log(movingUtil.isFolder("Untitled.md")); - console.log("CANCER"); + movingUtil.init(this.app); + console.log(movingUtil.isFile("Untitled.md")); + console.log(movingUtil.isFolder("Untitled.md")); + console.log("CANCER"); + this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData()); + console.log(this.settings); } async onunload() { console.log('unloading plugin')