mirror of
https://github.com/al0cam/AutoMover.git
synced 2026-07-22 12:10:26 +00:00
added default settings and settings file
This commit is contained in:
parent
c86919e355
commit
4670fdb291
3 changed files with 28 additions and 4 deletions
19
Settings/Settings.ts
Normal file
19
Settings/Settings.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import AutoMoverPlugin from "main";
|
||||
|
||||
export interface AutoMoverSettings {
|
||||
moveOnOpen: boolean,
|
||||
moveOnSave: boolean,
|
||||
moveOnClose: boolean,
|
||||
moveOnCreate: boolean,
|
||||
}
|
||||
|
||||
export const DEFAULT_SETTINGS: Partial<AutoMoverSettings> = {
|
||||
moveOnOpen: true,
|
||||
moveOnSave: true,
|
||||
moveOnClose: false,
|
||||
moveOnCreate: false,
|
||||
}
|
||||
|
||||
function loadSettings(AutoMoverPlugin: AutoMoverPlugin): Partial<AutoMoverSettings> {
|
||||
return Object.assign({}, DEFAULT_SETTINGS, AutoMoverPlugin.loadData());
|
||||
}
|
||||
BIN
bun.lockb
Executable file
BIN
bun.lockb
Executable file
Binary file not shown.
13
main.ts
13
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')
|
||||
|
|
|
|||
Loading…
Reference in a new issue