From a834a4fda0b02a81e71f3ce696baef787d959de9 Mon Sep 17 00:00:00 2001 From: dwelle Date: Sat, 23 Oct 2021 13:41:14 +0200 Subject: [PATCH] feat: expose app instance on `excalidrawAPI` --- src/components/App.tsx | 1 + src/types.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/components/App.tsx b/src/components/App.tsx index 858de1186..5386d28a9 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -332,6 +332,7 @@ class App extends React.Component { importLibrary: this.importLibraryFromUrl, setToastMessage: this.setToastMessage, id: this.id, + app: this, } as const; if (typeof excalidrawRef === "function") { excalidrawRef(api); diff --git a/src/types.ts b/src/types.ts index 46a9b7c9b..d79409cb6 100644 --- a/src/types.ts +++ b/src/types.ts @@ -378,4 +378,5 @@ export type ExcalidrawImperativeAPI = { readyPromise: ResolvablePromise; ready: true; id: string; + app: InstanceType; };