aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/editor/EditorButtons.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/frontend/src/editor/EditorButtons.tsx')
-rw-r--r--subprojects/frontend/src/editor/EditorButtons.tsx30
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 @@
7import type { Diagnostic } from '@codemirror/lint'; 7import type { Diagnostic } from '@codemirror/lint';
8import CancelIcon from '@mui/icons-material/Cancel'; 8import CancelIcon from '@mui/icons-material/Cancel';
9import CheckIcon from '@mui/icons-material/Check'; 9import CheckIcon from '@mui/icons-material/Check';
10import FileOpenIcon from '@mui/icons-material/FileOpen';
10import FormatListNumberedIcon from '@mui/icons-material/FormatListNumbered'; 11import FormatListNumberedIcon from '@mui/icons-material/FormatListNumbered';
11import FormatPaintIcon from '@mui/icons-material/FormatPaint'; 12import FormatPaintIcon from '@mui/icons-material/FormatPaint';
12import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined'; 13import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
13import LooksIcon from '@mui/icons-material/Looks'; 14import LooksIcon from '@mui/icons-material/Looks';
14import RedoIcon from '@mui/icons-material/Redo'; 15import RedoIcon from '@mui/icons-material/Redo';
16import SaveIcon from '@mui/icons-material/Save';
17import SaveAsIcon from '@mui/icons-material/SaveAs';
15import SearchIcon from '@mui/icons-material/Search'; 18import SearchIcon from '@mui/icons-material/Search';
16import UndoIcon from '@mui/icons-material/Undo'; 19import UndoIcon from '@mui/icons-material/Undo';
17import WarningIcon from '@mui/icons-material/Warning'; 20import 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>