1
1
import React from 'react'
2
- import { Checkbox , Dropdown , type IPivotStyles , PivotItem , TextField } from '@fluentui/react'
2
+ import { Checkbox , Dropdown , getTheme , type IPivotStyles , PivotItem , Text , TextField } from '@fluentui/react'
3
3
4
4
import { AnimatedPivot } from '~/components/elements/tabs/AnimatedPivot'
5
5
import { ThemeableComponent } from '~/components/utils/ThemeableComponent'
@@ -11,6 +11,8 @@ import type { RenderingBackend, TerminalSettings } from '~/store/terminal'
11
11
import { connect , type StateDispatch , type MonacoParamsChanges , type SettingsState } from '~/store'
12
12
13
13
import { cursorBlinkOptions , cursorLineOptions , fontOptions , terminalBackendOptions } from './options'
14
+ import { controlKeyLabel } from '~/utils/dom'
15
+ import { Kbd } from '~/components/elements/misc/Kbd'
14
16
15
17
export interface SettingsChanges {
16
18
monaco ?: MonacoParamsChanges
@@ -40,7 +42,7 @@ interface SettingsModalState {
40
42
41
43
const modalStyles = {
42
44
main : {
43
- maxWidth : 480 ,
45
+ maxWidth : 520 ,
44
46
} ,
45
47
}
46
48
@@ -100,6 +102,7 @@ class SettingsModal extends ThemeableComponent<Props, SettingsModalState> {
100
102
101
103
render ( ) {
102
104
const { isOpen } = this . props
105
+ const { spacing } = getTheme ( )
103
106
104
107
return (
105
108
< Dialog label = "Settings" onDismiss = { ( ) => this . onClose ( ) } isOpen = { isOpen } styles = { modalStyles } >
@@ -120,14 +123,27 @@ class SettingsModal extends ThemeableComponent<Props, SettingsModalState> {
120
123
}
121
124
/>
122
125
< SettingsProperty
123
- key = "minimap "
124
- title = "Mini Map "
126
+ key = "enableVimMode "
127
+ title = "Enable Vim Mode "
125
128
control = {
126
129
< Checkbox
127
- label = "Enable mini map on side "
128
- defaultChecked = { this . props . monaco ?. minimap }
130
+ label = "Enables Vim motions in code editor "
131
+ defaultChecked = { this . props . settings ?. enableVimMode }
129
132
onChange = { ( _ , val ) => {
130
- this . touchMonacoProperty ( 'minimap' , val )
133
+ this . touchSettingsProperty ( { enableVimMode : val } )
134
+ } }
135
+ />
136
+ }
137
+ />
138
+ < SettingsProperty
139
+ key = "enableAutoSave"
140
+ title = "Enable Auto Save"
141
+ control = {
142
+ < Checkbox
143
+ label = "Restore last editor contents when playground opens"
144
+ defaultChecked = { this . props . settings ?. autoSave }
145
+ onChange = { ( _ , val ) => {
146
+ this . touchSettingsProperty ( { autoSave : val } )
131
147
} }
132
148
/>
133
149
}
@@ -137,7 +153,7 @@ class SettingsModal extends ThemeableComponent<Props, SettingsModalState> {
137
153
title = "Use System Theme"
138
154
control = {
139
155
< Checkbox
140
- label = "Follow system dark mode preference instead of manual toggle. "
156
+ label = "Match editor theme with system dark mode preference"
141
157
defaultChecked = { this . props . settings ?. useSystemTheme }
142
158
onChange = { ( _ , val ) => {
143
159
this . touchSettingsProperty ( {
@@ -161,14 +177,18 @@ class SettingsModal extends ThemeableComponent<Props, SettingsModalState> {
161
177
}
162
178
/>
163
179
< SettingsProperty
164
- key = "enableVimMode "
165
- title = "Enable Vim Mode "
180
+ key = "mouseWheelZoom "
181
+ title = "Mouse Wheel Zoom "
166
182
control = {
167
183
< Checkbox
168
- label = "Allows usage of Vim key bindings when editing"
169
- defaultChecked = { this . props . settings ?. enableVimMode }
184
+ defaultChecked = { this . props . monaco ?. mouseWheelZoom }
185
+ onRenderLabel = { ( ) => (
186
+ < Text className = "ms-Checkbox-text" style = { { marginLeft : spacing . s2 } } >
187
+ Zoom the editor font when using mouse wheel and holding < Kbd > { controlKeyLabel ( ) } </ Kbd > key
188
+ </ Text >
189
+ ) }
170
190
onChange = { ( _ , val ) => {
171
- this . touchSettingsProperty ( { enableVimMode : val } )
191
+ this . touchMonacoProperty ( 'mouseWheelZoom' , val )
172
192
} }
173
193
/>
174
194
}
@@ -192,7 +212,7 @@ class SettingsModal extends ThemeableComponent<Props, SettingsModalState> {
192
212
< SettingsProperty
193
213
key = "cursorStyle"
194
214
title = "Cursor Style"
195
- description = "Set the cursor style"
215
+ description = "Controls the cursor style"
196
216
control = {
197
217
< Dropdown
198
218
options = { cursorLineOptions }
@@ -204,53 +224,53 @@ class SettingsModal extends ThemeableComponent<Props, SettingsModalState> {
204
224
}
205
225
/>
206
226
< SettingsProperty
207
- key = "selectOnLineNumbers "
208
- title = "Select On Line Numbers "
227
+ key = "smoothScroll "
228
+ title = "Smooth Scrolling "
209
229
control = {
210
230
< Checkbox
211
- label = "Select corresponding line on line number click "
212
- defaultChecked = { this . props . monaco ?. selectOnLineNumbers }
231
+ label = "Controls whether the editor will scroll using an animation "
232
+ defaultChecked = { this . props . monaco ?. smoothScrolling }
213
233
onChange = { ( _ , val ) => {
214
- this . touchMonacoProperty ( 'cursorStyle ' , val )
234
+ this . touchMonacoProperty ( 'smoothScrolling ' , val )
215
235
} }
216
236
/>
217
237
}
218
238
/>
219
239
< SettingsProperty
220
- key = "contextMenu "
221
- title = "Context Menu "
240
+ key = "minimap "
241
+ title = "Mini Map "
222
242
control = {
223
243
< Checkbox
224
- label = "Enable editor context menu (on right click) "
225
- defaultChecked = { this . props . monaco ?. contextMenu }
244
+ label = "Controls whether the minimap is shown "
245
+ defaultChecked = { this . props . monaco ?. minimap }
226
246
onChange = { ( _ , val ) => {
227
- this . touchMonacoProperty ( 'contextMenu ' , val )
247
+ this . touchMonacoProperty ( 'minimap ' , val )
228
248
} }
229
249
/>
230
250
}
231
251
/>
232
252
< SettingsProperty
233
- key = "smoothScroll "
234
- title = "Smooth Scrolling "
253
+ key = "selectOnGutterClick "
254
+ title = "Select On Gutter Click "
235
255
control = {
236
256
< Checkbox
237
- label = "Enable that the editor animates scrolling to a position "
238
- defaultChecked = { this . props . monaco ?. smoothScrolling }
257
+ label = "Select corresponding line on line number click "
258
+ defaultChecked = { this . props . monaco ?. selectOnLineNumbers }
239
259
onChange = { ( _ , val ) => {
240
- this . touchMonacoProperty ( 'smoothScrolling ' , val )
260
+ this . touchMonacoProperty ( 'cursorStyle ' , val )
241
261
} }
242
262
/>
243
263
}
244
264
/>
245
265
< SettingsProperty
246
- key = "mouseWheelZoom "
247
- title = "Mouse Wheel Zoom "
266
+ key = "contextMenu "
267
+ title = "Context Menu "
248
268
control = {
249
269
< Checkbox
250
- label = "Zoom the font in the editor when using the mouse wheel in combination with holding Ctrl "
251
- defaultChecked = { this . props . monaco ?. mouseWheelZoom }
270
+ label = "Enable editor context menu (on right click) "
271
+ defaultChecked = { this . props . monaco ?. contextMenu }
252
272
onChange = { ( _ , val ) => {
253
- this . touchMonacoProperty ( 'mouseWheelZoom ' , val )
273
+ this . touchMonacoProperty ( 'contextMenu ' , val )
254
274
} }
255
275
/>
256
276
}
0 commit comments