@@ -3,7 +3,7 @@ import React from 'react';
33import type { ExcalidrawImperativeAPI } from '@atyrode/excalidraw/types' ;
44import type { MainMenu as MainMenuType } from '@atyrode/excalidraw' ;
55
6- import { LogOut , SquarePlus , LayoutDashboard , SquareCode , Eye , Coffee , Grid2x2 , User , Text } from 'lucide-react' ;
6+ import { LogOut , SquarePlus , LayoutDashboard , SquareCode , Eye , Coffee , Grid2x2 , User , Text , ArchiveRestore } from 'lucide-react' ;
77import { capture } from '../utils/posthog' ;
88import { ExcalidrawElementFactory , PlacementMode } from '../lib/ExcalidrawElementFactory' ;
99import { useUserProfile } from "../api/hooks" ;
@@ -93,6 +93,22 @@ export const MainMenuConfig: React.FC<MainMenuConfigProps> = ({
9393 } ) ;
9494 } ;
9595
96+ const handleCanvasBackupsClick = ( ) => {
97+ if ( ! excalidrawAPI ) return ;
98+
99+ const backupsElement = ExcalidrawElementFactory . createEmbeddableElement ( {
100+ link : "!backups" ,
101+ width : 400 ,
102+ height : 500
103+ } ) ;
104+
105+ ExcalidrawElementFactory . placeInScene ( backupsElement , excalidrawAPI , {
106+ mode : PlacementMode . NEAR_VIEWPORT_CENTER ,
107+ bufferPercentage : 10 ,
108+ scrollToView : true
109+ } ) ;
110+ } ;
111+
96112 const handleGridToggle = ( ) => {
97113 if ( ! excalidrawAPI ) return ;
98114 const appState = excalidrawAPI . getAppState ( ) ;
@@ -136,6 +152,12 @@ export const MainMenuConfig: React.FC<MainMenuConfigProps> = ({
136152 < MainMenu . DefaultItems . LoadScene />
137153 < MainMenu . DefaultItems . Export />
138154 < MainMenu . DefaultItems . SaveAsImage />
155+ < MainMenu . Item
156+ icon = { < ArchiveRestore /> }
157+ onClick = { handleCanvasBackupsClick }
158+ >
159+ Canvas Backups
160+ </ MainMenu . Item >
139161 </ MainMenu . Group >
140162
141163 < MainMenu . Separator />
@@ -169,25 +191,25 @@ export const MainMenuConfig: React.FC<MainMenuConfigProps> = ({
169191 icon = { < SquareCode /> }
170192 onClick = { handleHtmlEditorClick }
171193 >
172- Insert HTML Editor
194+ HTML Editor
173195 </ MainMenu . Item >
174196 < MainMenu . Item
175197 icon = { < Text /> }
176198 onClick = { handleEditorClick }
177199 >
178- Insert Code Editor
200+ Code Editor
179201 </ MainMenu . Item >
180202 < MainMenu . Item
181203 icon = { < LayoutDashboard /> }
182204 onClick = { handleDashboardButtonClick }
183205 >
184- Insert Dashboard
206+ Dashboard
185207 </ MainMenu . Item >
186208 < MainMenu . Item
187209 icon = { < SquarePlus /> }
188210 onClick = { handleInsertButtonClick }
189211 >
190- Insert Button
212+ Action Button
191213 </ MainMenu . Item >
192214 </ MainMenu . Group >
193215
0 commit comments