mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-04-26 19:08:36 +00:00
- (Beta) ignore files handling Fixed: - Buttons on lock-detected-dialogue now can be shown in narrow-width devices. Improved: - Some constant has been flattened to be evaluated. - The usage of the deprecated API of obsidian has been reduced. - Now the indexedDB adapter will be enabled while the importing configuration. Misc: - Compiler, framework, and dependencies have been upgraded. - Due to standing for these impacts (especially in esbuild and svelte,) terser has been introduced. Feel free to notify your opinion to me! I do not like to obfuscate the code too.
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import { type AnyEntry, type DocumentID, type EntryDoc, type EntryHasPath, type FilePath, type FilePathWithPrefix } from "./lib/src/types";
|
|
import { PouchDB } from "./lib/src/pouchdb-browser.js";
|
|
import type ObsidianLiveSyncPlugin from "./main";
|
|
|
|
|
|
export abstract class LiveSyncCommands {
|
|
plugin: ObsidianLiveSyncPlugin;
|
|
get app() {
|
|
return this.plugin.app;
|
|
}
|
|
get settings() {
|
|
return this.plugin.settings;
|
|
}
|
|
get localDatabase() {
|
|
return this.plugin.localDatabase;
|
|
}
|
|
id2path(id: DocumentID, entry?: EntryHasPath, stripPrefix?: boolean): FilePathWithPrefix {
|
|
return this.plugin.id2path(id, entry, stripPrefix);
|
|
}
|
|
async path2id(filename: FilePathWithPrefix | FilePath, prefix?: string): Promise<DocumentID> {
|
|
return await this.plugin.path2id(filename, prefix);
|
|
}
|
|
getPath(entry: AnyEntry): FilePathWithPrefix {
|
|
return this.plugin.getPath(entry);
|
|
}
|
|
|
|
constructor(plugin: ObsidianLiveSyncPlugin) {
|
|
this.plugin = plugin;
|
|
}
|
|
abstract onunload(): void;
|
|
abstract onload(): void | Promise<void>;
|
|
abstract onInitializeDatabase(showNotice: boolean): void | Promise<void>;
|
|
abstract beforeReplicate(showNotice: boolean): void | Promise<void>;
|
|
abstract onResume(): void | Promise<void>;
|
|
abstract parseReplicationResultItem(docs: PouchDB.Core.ExistingDocument<EntryDoc>): Promise<boolean> | boolean;
|
|
abstract realizeSettingSyncMode(): Promise<void>;
|
|
}
|