Skip to content

Commit

Permalink
Fix bug with files in folders causing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Lee committed Mar 1, 2023
1 parent 4e0623f commit c2fa26c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
5 changes: 2 additions & 3 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ export default class OpenInNewTabPlugin extends Plugin {
// Check all open panes for a matching path
this.app.workspace.iterateAllLeaves((leaf: WorkspaceLeaf) => {
const viewState = leaf.getViewState()

const matchesMarkdownFile = viewState.type === 'markdown' && viewState.state?.file === `${fileName}.md`;
const matchesNonMarkdownFile = viewState.type !== 'markdown' && viewState.state?.file === fileName;
const matchesMarkdownFile = viewState.type === 'markdown' && viewState.state?.file?.endsWith(`${fileName}.md`);
const matchesNonMarkdownFile = viewState.type !== 'markdown' && viewState.state?.file?.endsWith(fileName);

if (
matchesMarkdownFile || matchesNonMarkdownFile
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "open-in-new-tab",
"name": "Open In New Tab",
"version": "1.0.8",
"version": "1.0.9",
"minAppVersion": "0.15.0",
"description": "Opens files in new tabs",
"author": "Patrick Lee",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "open-in-new-tab",
"version": "1.0.8",
"version": "1.0.9",
"description": "Open In New Tab",
"main": "main.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"1.0.5": "0.15.0",
"1.0.6": "0.15.0",
"1.0.7": "0.15.0",
"1.0.8": "0.15.0"
"1.0.8": "0.15.0",
"1.0.9": "0.15.0"
}

0 comments on commit c2fa26c

Please sign in to comment.