obsidian-semantic

Log | Files | Refs | README

commit 9a0b47b7dc3cf1de35abbc4b6b5f396f6ce3f61f
parent 080c1b55c92058dbbe987b56b2b5ddb20e17a2fb
Author: Thomas Vigouroux <me@vigoux.eu>
Date:   Fri,  3 May 2024 09:29:30 +0200

fix: overwrite biblio when extracting

Diffstat:
Mmain.ts | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/main.ts b/main.ts @@ -107,8 +107,6 @@ export default class SemanticIntegration extends Plugin { async onload() { await this.loadSettings(); - this.apiAccess = new SemanticApi(this.settings.apiKey); - this.addRibbonIcon('book-plus', 'Add a new reference', (evt: MouseEvent) => { this.openModal(); }); @@ -142,11 +140,12 @@ export default class SemanticIntegration extends Plugin { allbibtex += infos.bibtex; } } - Vault.recurseChildren(folder, async (mfile) => { - }); - - console.log(allbibtex); - await this.app.vault.create("biblio.bib", allbibtex); + var oldfile = this.app.vault.getFileByPath("biblio.bib") + if (oldfile != null) { + await this.app.vault.modify(oldfile, allbibtex); + } else { + await this.app.vault.create("biblio.bib", allbibtex); + } } }); @@ -179,6 +178,7 @@ export default class SemanticIntegration extends Plugin { async loadSettings() { this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData()); + this.apiAccess = new SemanticApi(this.settings.apiKey) } async saveSettings() {