diff options
Diffstat (limited to 'subprojects/frontend/src/editor/EditorButtons.tsx')
-rw-r--r-- | subprojects/frontend/src/editor/EditorButtons.tsx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/subprojects/frontend/src/editor/EditorButtons.tsx b/subprojects/frontend/src/editor/EditorButtons.tsx index f4513909..4afba607 100644 --- a/subprojects/frontend/src/editor/EditorButtons.tsx +++ b/subprojects/frontend/src/editor/EditorButtons.tsx | |||
@@ -7,11 +7,14 @@ | |||
7 | import type { Diagnostic } from '@codemirror/lint'; | 7 | import type { Diagnostic } from '@codemirror/lint'; |
8 | import CancelIcon from '@mui/icons-material/Cancel'; | 8 | import CancelIcon from '@mui/icons-material/Cancel'; |
9 | import CheckIcon from '@mui/icons-material/Check'; | 9 | import CheckIcon from '@mui/icons-material/Check'; |
10 | import FileOpenIcon from '@mui/icons-material/FileOpen'; | ||
10 | import FormatListNumberedIcon from '@mui/icons-material/FormatListNumbered'; | 11 | import FormatListNumberedIcon from '@mui/icons-material/FormatListNumbered'; |
11 | import FormatPaintIcon from '@mui/icons-material/FormatPaint'; | 12 | import FormatPaintIcon from '@mui/icons-material/FormatPaint'; |
12 | import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined'; | 13 | import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined'; |
13 | import LooksIcon from '@mui/icons-material/Looks'; | 14 | import LooksIcon from '@mui/icons-material/Looks'; |
14 | import RedoIcon from '@mui/icons-material/Redo'; | 15 | import RedoIcon from '@mui/icons-material/Redo'; |
16 | import SaveIcon from '@mui/icons-material/Save'; | ||
17 | import SaveAsIcon from '@mui/icons-material/SaveAs'; | ||
15 | import SearchIcon from '@mui/icons-material/Search'; | 18 | import SearchIcon from '@mui/icons-material/Search'; |
16 | import UndoIcon from '@mui/icons-material/Undo'; | 19 | import UndoIcon from '@mui/icons-material/Undo'; |
17 | import WarningIcon from '@mui/icons-material/Warning'; | 20 | import WarningIcon from '@mui/icons-material/Warning'; |
@@ -47,10 +50,37 @@ export default observer(function EditorButtons({ | |||
47 | return ( | 50 | return ( |
48 | <Stack direction="row" flexGrow={1}> | 51 | <Stack direction="row" flexGrow={1}> |
49 | <IconButton | 52 | <IconButton |
53 | disabled={editorStore === undefined} | ||
54 | onClick={() => editorStore?.openFile()} | ||
55 | aria-label="Open" | ||
56 | color="inherit" | ||
57 | > | ||
58 | <FileOpenIcon fontSize="small" /> | ||
59 | </IconButton> | ||
60 | <IconButton | ||
61 | disabled={editorStore === undefined || !editorStore.unsavedChanges} | ||
62 | onClick={() => editorStore?.saveFile()} | ||
63 | aria-label="Save" | ||
64 | color="inherit" | ||
65 | > | ||
66 | <SaveIcon fontSize="small" /> | ||
67 | </IconButton> | ||
68 | {'showSaveFilePicker' in window && ( | ||
69 | <IconButton | ||
70 | disabled={editorStore === undefined} | ||
71 | onClick={() => editorStore?.saveFileAs()} | ||
72 | aria-label="Save as" | ||
73 | color="inherit" | ||
74 | > | ||
75 | <SaveAsIcon fontSize="small" /> | ||
76 | </IconButton> | ||
77 | )} | ||
78 | <IconButton | ||
50 | disabled={editorStore === undefined || !editorStore.canUndo} | 79 | disabled={editorStore === undefined || !editorStore.canUndo} |
51 | onClick={() => editorStore?.undo()} | 80 | onClick={() => editorStore?.undo()} |
52 | aria-label="Undo" | 81 | aria-label="Undo" |
53 | color="inherit" | 82 | color="inherit" |
83 | sx={{ ml: 1 }} | ||
54 | > | 84 | > |
55 | <UndoIcon fontSize="small" /> | 85 | <UndoIcon fontSize="small" /> |
56 | </IconButton> | 86 | </IconButton> |