bleh type checks

This commit is contained in:
Ell 2023-08-18 12:58:43 +02:00
parent 46cfbdfd36
commit d852b61a67

View file

@ -17,9 +17,9 @@ export class JSPView extends ItemView {
let content = this.contentEl.createDiv({cls: "just-share-please-view"}); let content = this.contentEl.createDiv({cls: "just-share-please-view"});
if (this.plugin.settings.shared.length > 0) { if (this.plugin.settings.shared.length > 0) {
for (let shared of this.plugin.settings.shared) { for (let shared of this.plugin.settings.shared) {
let file = this.plugin.app.vault.getAbstractFileByPath(shared.path) ; let abstractFile = this.plugin.app.vault.getAbstractFileByPath(shared.path);
if(!(file instanceof TFile)) if (abstractFile instanceof TFile) {
continue; let file = abstractFile;
let div = content.createDiv({cls: "just-share-please-shared-item"}); let div = content.createDiv({cls: "just-share-please-shared-item"});
div.createSpan({cls: "just-share-please-shared-name", text: removeExtension(shared.path).split(/[/\\]/g).pop()}); div.createSpan({cls: "just-share-please-shared-name", text: removeExtension(shared.path).split(/[/\\]/g).pop()});
if (file?.path.match(/[/\\]/)) if (file?.path.match(/[/\\]/))
@ -51,6 +51,7 @@ export class JSPView extends ItemView {
.setIcon("trash") .setIcon("trash")
.onClick(async () => this.plugin.deleteFile(shared)); .onClick(async () => this.plugin.deleteFile(shared));
} }
}
} else { } else {
content.createSpan({text: "You have not shared any items yet."}); content.createSpan({text: "You have not shared any items yet."});
} }