Skip to content

Commit

Permalink
Check for existance of ExcalidrawAutomate
Browse files Browse the repository at this point in the history
If the plugin is not installed, the following error occurs:
"ReferenceError: ExcalidrawAutomate is not defined at UpdateTimeOnSavePlugin.handleFileChange"
  • Loading branch information
vonalbert authored Jul 28, 2023
1 parent 5e211bb commit 6ec8113
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default class UpdateTimeOnSavePlugin extends Plugin {
}

//@ts-ignore
const ea: any = ExcalidrawAutomate; //ea will be undefined if the Excalidraw plugin is not running
const ea: any = typeof ExcalidrawAutomate === "undefined" ? undefined : ExcalidrawAutomate; //ea will be undefined if the Excalidraw plugin is not running
const isExcalidrawFile = ea ? ea.isExcalidrawFile(file) : false;

if (isExcalidrawFile) {
Expand Down

0 comments on commit 6ec8113

Please sign in to comment.