-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exclude excalidraw files from plugin globally
Closes #37
- Loading branch information
Showing
3 changed files
with
242 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { App, TFile } from 'obsidian'; | ||
|
||
export function isExcalidraw(app: App, f: TFile) { | ||
if (f.extension === 'excalidraw' || /.*\.excalidraw\.md$/g.test(f.path)) { | ||
return true; | ||
} | ||
const fileCache = app.metadataCache.getFileCache(f); | ||
return ( | ||
!!fileCache?.frontmatter && !!fileCache.frontmatter['excalidraw-plugin'] | ||
); | ||
} | ||
|
||
export function isExcluded(app: App, f: TFile) { | ||
if (isExcalidraw(app, f)) { | ||
return true; | ||
} | ||
|
||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.