Skip to content

Commit

Permalink
Merge pull request #8 from relay-md/release/20240215
Browse files Browse the repository at this point in the history
Release/20240215
  • Loading branch information
xeroc authored Feb 15, 2024
2 parents 61891d4 + 9ab7620 commit 2e5ac8f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,19 @@ export class DocumentRepo {
}
}

async locate_document(document_id: string) {
async locate_document(document_id: string): Promise<Array<TFile> | null> {
const files = this.plugin.app.vault.getMarkdownFiles();
let located_files = [];
for (let i = 0; i < files.length; i++) {
const activeFile = files[i];
const metadata = this.plugin.app.metadataCache.getCache(activeFile.path);
if (!metadata || !metadata.frontmatter) {
return;
continue;
}
if (metadata.frontmatter["relay-document"] == document_id)
if (metadata.frontmatter["relay-document"] === document_id) {
console.log("Found an existing file with the document id " + document_id);
located_files.push(activeFile);
}
}
return located_files;
}
Expand Down

0 comments on commit 2e5ac8f

Please sign in to comment.