Skip to content

Commit

Permalink
0.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
zsviczian committed Jul 30, 2023
1 parent 738100a commit ed424a4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/Scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ export class Scene {
...settings.baseNodeStyle,
...settings.centralNodeStyle,
};
style.textColor = settings.baseNodeStyle.textColor;

let counter = 0;
ea.clear();
Expand Down
2 changes: 1 addition & 1 deletion src/Settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const DEFAULT_SETTINGS: ExcaliBrainSettings = {
baseNodeStyle: DEFAULT_NODE_STYLE,
centralNodeStyle: {
fontSize: 30,
backgroundColor: "#C49A13FF",
backgroundColor: "#B5B5B5",
textColor: "#000000ff",
},
inferredNodeStyle: {
Expand Down
31 changes: 26 additions & 5 deletions src/graph/URLParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}));
}));*/
}

}

0 comments on commit ed424a4

Please sign in to comment.