From 6c103fe1dd6e359a21eb9f4eb061fee6dfcb4223 Mon Sep 17 00:00:00 2001 From: Axelle Abbadie Date: Wed, 13 May 2026 00:28:06 +0200 Subject: [PATCH] fix: revert trashFile, add explicit type casts for any warnings --- main.js | 2 +- src/main.ts | 4 ++-- src/mappings/ScopeResolver.ts | 2 +- src/ui/QuickPseudonymizeModal.ts | 2 +- src/ui/RuleModal.ts | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/main.js b/main.js index cce41a4..1e1aab1 100644 --- a/main.js +++ b/main.js @@ -1345,7 +1345,7 @@ var PseudObsPlugin = class extends import_obsidian7.Plugin { const store = new MappingStore({ type: "file", path: mdPath }); await this.app.vault.create(mappingPath, JSON.stringify(store.toJSON(), null, 2)); } - await this.app.fileManager.trashFile(file); + await this.app.vault.delete(file); const mdFile = this.app.vault.getAbstractFileByPath(mdPath); if (mdFile instanceof import_obsidian7.TFile) { await this.app.workspace.getLeaf().openFile(mdFile); diff --git a/src/main.ts b/src/main.ts index 2d9e370..1766844 100644 --- a/src/main.ts +++ b/src/main.ts @@ -239,7 +239,7 @@ export default class PseudObsPlugin extends Plugin { } // Supprimer le fichier source non-Markdown maintenant remplacé par le .md - await this.app.fileManager.trashFile(file); + await this.app.vault.delete(file); // Ouvrir le .md const mdFile = this.app.vault.getAbstractFileByPath(mdPath); @@ -445,7 +445,7 @@ export default class PseudObsPlugin extends Plugin { } async loadSettings(): Promise { - this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData()); + this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData()) as PseudObsSettings; } async saveSettings(): Promise { diff --git a/src/mappings/ScopeResolver.ts b/src/mappings/ScopeResolver.ts index 204b01b..1fd2ac1 100644 --- a/src/mappings/ScopeResolver.ts +++ b/src/mappings/ScopeResolver.ts @@ -29,7 +29,7 @@ export class ScopeResolver { try { const raw = await this.vault.read(child); - const data: MappingFile = JSON.parse(raw); + const data = JSON.parse(raw) as MappingFile; const store = MappingStore.fromJSON(data); allRules.push(...store.getValidatedFor(filePath)); } catch { diff --git a/src/ui/QuickPseudonymizeModal.ts b/src/ui/QuickPseudonymizeModal.ts index daee9cb..7807a95 100644 --- a/src/ui/QuickPseudonymizeModal.ts +++ b/src/ui/QuickPseudonymizeModal.ts @@ -164,7 +164,7 @@ export class QuickPseudonymizeModal extends Modal { const mappingTFile = this.app.vault.getAbstractFileByPath(mappingPath); if (mappingTFile instanceof TFile) { - const data: MappingFile = JSON.parse(await this.app.vault.read(mappingTFile)); + const data = JSON.parse(await this.app.vault.read(mappingTFile)) as MappingFile; store = MappingStore.fromJSON(data); } else { await this.plugin.ensureFolder(this.plugin.settings.mappingFolder); diff --git a/src/ui/RuleModal.ts b/src/ui/RuleModal.ts index 502a6cd..2978471 100644 --- a/src/ui/RuleModal.ts +++ b/src/ui/RuleModal.ts @@ -145,7 +145,7 @@ export class RuleModal extends Modal { const mappingFile = this.app.vault.getAbstractFileByPath(mappingPath); if (mappingFile instanceof TFile) { - const data: MappingFile = JSON.parse(await this.app.vault.read(mappingFile)); + const data = JSON.parse(await this.app.vault.read(mappingFile)) as MappingFile; store = MappingStore.fromJSON(data); } else { await this.plugin.ensureFolder(this.plugin.settings.mappingFolder);