@@ -11,8 +11,18 @@ import ListItemText from "@mui/material/ListItemText";
11
11
import ListItemIcon from "@mui/material/ListItemIcon" ;
12
12
import Typography from "@mui/material/Typography" ;
13
13
import Paper from '@mui/material/Paper' ;
14
- import { openFile , openNewFile , saveNotebookToFileSystem } from "../../lib/FileSystem/fileSystem" ;
15
- import { addNotebook , setActiveNotebookTabNumber , updateActiveNotebookName , setNotebookIsSaving } from "../../lib/state/reducer"
14
+ import {
15
+ openFile ,
16
+ openNewFile ,
17
+ saveNotebookToFileSystem ,
18
+ downloadAsNewNotebook ,
19
+ } from "../../lib/FileSystem/fileSystem" ;
20
+ import {
21
+ addNotebook ,
22
+ setActiveNotebookTabNumber ,
23
+ updateActiveNotebookName ,
24
+ setNotebookIsSaving
25
+ } from "../../lib/state/reducer"
16
26
import { useDispatch , useSelector } from 'react-redux' ;
17
27
import { AppState } from '../../lib/typings/types' ;
18
28
@@ -45,6 +55,12 @@ export default function FileMenu() {
45
55
dispatch ( setNotebookIsSaving ( false ) )
46
56
}
47
57
58
+ const downloadActiveNotebook = async ( ) => {
59
+ const currentNotebook = { ...notebooks [ activeNotebookName ] }
60
+ await downloadAsNewNotebook ( currentNotebook )
61
+ }
62
+
63
+
48
64
return (
49
65
< Paper sx = { { width : 320 , maxWidth : '100%' } } >
50
66
< MenuList >
@@ -84,7 +100,7 @@ export default function FileMenu() {
84
100
⌘S
85
101
</ Typography >
86
102
</ MenuItem >
87
- < MenuItem >
103
+ < MenuItem onClick = { ( ) => downloadActiveNotebook ( ) } >
88
104
< ListItemIcon >
89
105
< SaveAltIcon fontSize = "small" />
90
106
</ ListItemIcon >
0 commit comments