Created
November 9, 2023 21:40
-
-
Save zsviczian/d8f06a95c9ae628fe0d33bc5d9a6d7a5 to your computer and use it in GitHub Desktop.
ExcalidrawAutomate onFileOpenHook
This file contains hidden or 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
https://youtu.be/OX5_UYjXEvc | |
 |
This file contains hidden or 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
<%* | |
/* | |
```js*/ | |
let watchdog = 0; //watchdog ensures we don't get into an infinite loop in case Excalidraw does not start up | |
while(!window.ExcalidrawAutomate && watchdog++<50) await sleep(50); | |
if(!window.ExcalidrawAutomate) return; | |
window.ExcalidrawAutomate.onFileOpenHook = (data) => { | |
const {ea, excalidrawFile, view} = data; //not needed now, including this just for information. | |
app.commands.executeCommandById("obsidian-excalidraw-plugin:Downloaded/Set Grid"); | |
} | |
console.log("Excalidraw onFileOpenHook is installed"); | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment