diff --git a/manifest.json b/manifest.json index e65b2aa..f848e02 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "excalibrain", "name": "ExcaliBrain", - "version": "0.2.3", + "version": "0.2.4", "minAppVersion": "1.1.6", "description": "A clean, intuitive and editable graph view for Obsidian", "author": "Zsolt Viczian", diff --git a/src/Scene.ts b/src/Scene.ts index b21b616..14dd071 100644 --- a/src/Scene.ts +++ b/src/Scene.ts @@ -284,6 +284,7 @@ export class Scene { ...settings.baseNodeStyle, ...settings.centralNodeStyle, }; + style.textColor = settings.baseNodeStyle.textColor; let counter = 0; ea.clear(); diff --git a/src/Settings.ts b/src/Settings.ts index 3b5ba21..0f2e224 100644 --- a/src/Settings.ts +++ b/src/Settings.ts @@ -103,7 +103,7 @@ export const DEFAULT_SETTINGS: ExcaliBrainSettings = { baseNodeStyle: DEFAULT_NODE_STYLE, centralNodeStyle: { fontSize: 30, - backgroundColor: "#C49A13FF", + backgroundColor: "#B5B5B5", textColor: "#000000ff", }, inferredNodeStyle: { diff --git a/src/graph/URLParser.ts b/src/graph/URLParser.ts index e580fae..721e238 100644 --- a/src/graph/URLParser.ts +++ b/src/graph/URLParser.ts @@ -97,17 +97,38 @@ export class URLParser { } private registerFileEvents(): void { - const modifyEventHandler = async (file: TFile) => { - await this.parseFileURLs(file); + const modifyEventHandler = (file: TFile) => { + deleteEventHandler(file); + this.parseFileURLs(file); }; + const deleteEventHandler = (file: TFile) => { + const urls = this.fileToUrlMap.get(file); + this.fileToUrlMap.delete(file); + if(urls) { + urls.forEach((url) => { + const data = this.fileUrlInverseMap.get(url.url); + if (data) { + data.files = data.files.filter((f) => f !== file); + if (data.files.length === 0) { + this.fileUrlInverseMap.delete(url.url); + this.hosts = this.hosts.filter((h) => h !== data.origin); + return; + } + this.fileUrlInverseMap.set(url.url, data); + } + }); + } + + } + this.plugin.registerEvent(this.app.vault.on('create', modifyEventHandler)); this.plugin.registerEvent(this.app.vault.on('modify', modifyEventHandler)); - this.plugin.registerEvent(this.app.vault.on('delete', (file:TFile) => this.fileToUrlMap.delete(file))); - this.plugin.registerEvent(this.app.vault.on('rename', async (file:TFile) => { + this.plugin.registerEvent(this.app.vault.on('delete', deleteEventHandler)); + /*this.plugin.registerEvent(this.app.vault.on('rename', async (file:TFile) => { this.fileToUrlMap.delete(file); await this.parseFileURLs(file); - })); + }));*/ } }