mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-07-25 14:02:58 +00:00
refactor: align platform APIs with community review
This commit is contained in:
@@ -41,22 +41,12 @@ export class ObsidianVaultAdapter implements IVaultAdapter<TFile, TFolder> {
|
||||
return await this.app.vault.rename(file, newPath);
|
||||
}
|
||||
|
||||
async delete(file: TFile | TFolder, force = false): Promise<void> {
|
||||
if ("trashFile" in this.app.fileManager) {
|
||||
// eslint-disable-next-line obsidianmd/no-unsupported-api
|
||||
return await this.app.fileManager.trashFile(file);
|
||||
}
|
||||
// eslint-disable-next-line obsidianmd/prefer-file-manager-trash-file -- Fallback for older versions of Obsidian without trashFile support
|
||||
return await this.app.vault.delete(file, force);
|
||||
async delete(file: TFile | TFolder): Promise<void> {
|
||||
return await this.app.fileManager.trashFile(file);
|
||||
}
|
||||
|
||||
async trash(file: TFile | TFolder, force = false): Promise<void> {
|
||||
if ("trashFile" in this.app.fileManager) {
|
||||
// eslint-disable-next-line obsidianmd/no-unsupported-api
|
||||
return await this.app.fileManager.trashFile(file);
|
||||
}
|
||||
// eslint-disable-next-line obsidianmd/prefer-file-manager-trash-file -- Fallback for older versions of Obsidian without trashFile support
|
||||
return await this.app.vault.trash(file, force);
|
||||
async trash(file: TFile | TFolder): Promise<void> {
|
||||
return await this.app.fileManager.trashFile(file);
|
||||
}
|
||||
|
||||
trigger(name: string, ...data: unknown[]): void {
|
||||
|
||||
Reference in New Issue
Block a user