Skip to content

Commit

Permalink
Fix conflict with Excalidraw autosave.
Browse files Browse the repository at this point in the history
  • Loading branch information
chhoumann authored Jan 21, 2022
2 parents 8fe2c28 + 41c8255 commit a835c79
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/automators/onFileModifyAutomatorManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ export class OnFileModifyAutomatorManager implements IAutomatorManager {
const outfile: TFile = abstractFileToMarkdownTFile(file);
if (!outfile) return;

// Return on Excalidraw files to prevent conflict with its auto-save feature.
const metadata = await this.app.metadataCache.getFileCache(outfile);
const keys = Object.keys(metadata?.frontmatter);
if (keys && keys.some(key => key.toLowerCase().contains("excalidraw"))) {
return;
}

const fileContent: string = await this.app.vault.cachedRead(outfile);
if (!this.updatedFileCache.set(outfile.path, fileContent)) return;

Expand Down

0 comments on commit a835c79

Please sign in to comment.