From 3228ff635204e9fd52cb2ecec70eaeb8f1ff0a31 Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Thu, 18 Nov 2021 11:23:19 +0000 Subject: [PATCH] Add prompt to confirm new project --- packages/tldraw/src/hooks/useFileSystem.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/tldraw/src/hooks/useFileSystem.ts b/packages/tldraw/src/hooks/useFileSystem.ts index 99ee9ba39..e2a2350e3 100644 --- a/packages/tldraw/src/hooks/useFileSystem.ts +++ b/packages/tldraw/src/hooks/useFileSystem.ts @@ -18,8 +18,10 @@ export function useFileSystem() { const onNewProject = React.useCallback( async (app: TldrawApp) => { - await promptSaveBeforeChange(app) - app.newProject() + if (window.confirm('Do you want to create a new project?')) { + await promptSaveBeforeChange(app) + app.newProject() + } }, [promptSaveBeforeChange] )