Skip to content

Commit

Permalink
refactor: add native obsidian api functions
Browse files Browse the repository at this point in the history
  • Loading branch information
johackim committed Dec 7, 2022
1 parent a610576 commit fb450e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/views/chapters.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ export default class ChaptersView extends ItemView {
});

navFile.addEventListener('click', async () => {
const targetFile = this.app.vault.getMarkdownFiles().find((f) => f.path === `${chapter}.md`)
const targetFile = this.app.vault.getAbstractFileByPath(`${chapter}.md`)
|| await this.app.vault.create(`${chapter}.md`, '');
const leaf = this.app.workspace.getMostRecentLeaf();
const leaf = this.app.workspace.getLeaf();
leaf.openFile(targetFile);
});
}
Expand Down

0 comments on commit fb450e4

Please sign in to comment.