Skip to content

Commit 41efdc6

Browse files
committed
Suppressed warnings that were either unavoidable or already checked in method.
1 parent 352f125 commit 41efdc6

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

linkManager.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11

22
import { ObsidianRenderer, ObsidianLink, LinkPair, GltLink, DataviewLinkType } from 'types';
3-
import { Page, getAPI } from 'obsidian-dataview';
3+
import { getAPI } from 'obsidian-dataview';
44
import { Text, TextStyle } from 'pixi.js';
5+
// @ts-ignore
56
import extractLinks from 'markdown-link-extractor';
67

78

@@ -156,6 +157,7 @@ export class LinkManager {
156157
// Here, we assume that dark themes have a background color with a low brightness value.
157158
let textColor = '#FF0000';
158159
if (style && style.backgroundColor && style.backgroundColor) {
160+
// @ts-ignore
159161
const isDarkTheme = style.backgroundColor.match(/\d+/g)?.map(Number).slice(0, 3).reduce((a, b) => a + b, 0) < 382.5;
160162
isDarkTheme ? textColor = '#FFFFFF' : textColor = '#000000'; // White text for dark themes, black for light themes)
161163
}
@@ -193,14 +195,15 @@ export class LinkManager {
193195

194196
// Get the metadata key for a link between two pages
195197
private getMetadataKeyForLink(sourceId: string, targetId: string): string | null {
196-
const sourcePage: Page | undefined = this.api.page(sourceId);
198+
const sourcePage: any = this.api.page(sourceId);
197199
if (!sourcePage) return null;
198200

199201
for (const [key, value] of Object.entries(sourcePage)) {
200202
const valueType = this.determineDataviewLinkType(value);
201203

202204
switch (valueType) {
203205
case DataviewLinkType.WikiLink:
206+
// @ts-ignore
204207
if (value.path === targetId) {
205208
return key;
206209
}
@@ -211,6 +214,7 @@ export class LinkManager {
211214
}
212215
break;
213216
case DataviewLinkType.Array:
217+
// @ts-ignore
214218
for (const item of value) {
215219
if (this.determineDataviewLinkType(item) === DataviewLinkType.WikiLink && item.path === targetId) {
216220
return key;
@@ -220,7 +224,8 @@ export class LinkManager {
220224
}
221225
}
222226
break;
223-
// Handle other cases as needed
227+
default:
228+
console.warn("Link type from Obsidian not in recognized format.");
224229
}
225230
}
226231
return null;

main.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,18 @@ export default class GraphLinkTypesPlugin extends Plugin {
2323
this.handleLayoutChange();
2424
}));
2525

26+
// @ts-ignore
2627
this.registerEvent(this.app.metadataCache.on("dataview:index-ready", () => {
2728
console.log("Index ready, drawing graph link types.");
2829
this.handleLayoutChange();
2930
}));
3031

32+
// @ts-ignore
3133
this.registerEvent(this.app.metadataCache.on("dataview:metadata-change", () => {
3234
console.log("New metadata, drawing graph link types.");
3335
this.handleLayoutChange();
3436
}));
3537

36-
// // Add a command to the command palette
37-
// this.addCommand({
38-
// id: 'print-link-type',
39-
// name: 'Print Link Type',
40-
// callback: () => {
41-
// this.toyLinks();
42-
// }
43-
// });
4438
}
4539

4640

@@ -51,6 +45,7 @@ export default class GraphLinkTypesPlugin extends Plugin {
5145
findRenderer(): ObsidianRenderer | null {
5246
let graphLeaves = this.app.workspace.getLeavesOfType('graph');
5347
for (const leaf of graphLeaves) {
48+
// @ts-ignore
5449
const renderer = leaf.view.renderer;
5550
if (this.isObsidianRenderer(renderer)) {
5651
return renderer;
@@ -59,6 +54,7 @@ export default class GraphLinkTypesPlugin extends Plugin {
5954

6055
graphLeaves = this.app.workspace.getLeavesOfType('localgraph');
6156
for (const leaf of graphLeaves) {
57+
// @ts-ignore
6258
const renderer = leaf.view.renderer;
6359
if (this.isObsidianRenderer(renderer)) {
6460
return renderer;

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "graph-link-types",
33
"name": "Graph Link Types",
4-
"version": "0.2.0",
4+
"version": "0.2.1",
55
"minAppVersion": "1.5.0",
66
"description": "Link types for Obsidian graph view.",
77
"author": "natefrisch01",

0 commit comments

Comments
 (0)