11import 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'
33
44import { AnimatedPivot } from '~/components/elements/tabs/AnimatedPivot'
55import { ThemeableComponent } from '~/components/utils/ThemeableComponent'
@@ -11,6 +11,8 @@ import type { RenderingBackend, TerminalSettings } from '~/store/terminal'
1111import { connect , type StateDispatch , type MonacoParamsChanges , type SettingsState } from '~/store'
1212
1313import { cursorBlinkOptions , cursorLineOptions , fontOptions , terminalBackendOptions } from './options'
14+ import { controlKeyLabel } from '~/utils/dom'
15+ import { Kbd } from '~/components/elements/misc/Kbd'
1416
1517export interface SettingsChanges {
1618 monaco ?: MonacoParamsChanges
@@ -40,7 +42,7 @@ interface SettingsModalState {
4042
4143const modalStyles = {
4244 main : {
43- maxWidth : 480 ,
45+ maxWidth : 520 ,
4446 } ,
4547}
4648
@@ -100,6 +102,7 @@ class SettingsModal extends ThemeableComponent<Props, SettingsModalState> {
100102
101103 render ( ) {
102104 const { isOpen } = this . props
105+ const { spacing } = getTheme ( )
103106
104107 return (
105108 < Dialog label = "Settings" onDismiss = { ( ) => this . onClose ( ) } isOpen = { isOpen } styles = { modalStyles } >
@@ -120,14 +123,27 @@ class SettingsModal extends ThemeableComponent<Props, SettingsModalState> {
120123 }
121124 />
122125 < SettingsProperty
123- key = "minimap "
124- title = "Mini Map "
126+ key = "enableVimMode "
127+ title = "Enable Vim Mode "
125128 control = {
126129 < 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 }
129132 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 } )
131147 } }
132148 />
133149 }
@@ -137,7 +153,7 @@ class SettingsModal extends ThemeableComponent<Props, SettingsModalState> {
137153 title = "Use System Theme"
138154 control = {
139155 < Checkbox
140- label = "Follow system dark mode preference instead of manual toggle. "
156+ label = "Match editor theme with system dark mode preference"
141157 defaultChecked = { this . props . settings ?. useSystemTheme }
142158 onChange = { ( _ , val ) => {
143159 this . touchSettingsProperty ( {
@@ -161,14 +177,18 @@ class SettingsModal extends ThemeableComponent<Props, SettingsModalState> {
161177 }
162178 />
163179 < SettingsProperty
164- key = "enableVimMode "
165- title = "Enable Vim Mode "
180+ key = "mouseWheelZoom "
181+ title = "Mouse Wheel Zoom "
166182 control = {
167183 < 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+ ) }
170190 onChange = { ( _ , val ) => {
171- this . touchSettingsProperty ( { enableVimMode : val } )
191+ this . touchMonacoProperty ( 'mouseWheelZoom' , val )
172192 } }
173193 />
174194 }
@@ -192,7 +212,7 @@ class SettingsModal extends ThemeableComponent<Props, SettingsModalState> {
192212 < SettingsProperty
193213 key = "cursorStyle"
194214 title = "Cursor Style"
195- description = "Set the cursor style"
215+ description = "Controls the cursor style"
196216 control = {
197217 < Dropdown
198218 options = { cursorLineOptions }
@@ -204,53 +224,53 @@ class SettingsModal extends ThemeableComponent<Props, SettingsModalState> {
204224 }
205225 />
206226 < SettingsProperty
207- key = "selectOnLineNumbers "
208- title = "Select On Line Numbers "
227+ key = "smoothScroll "
228+ title = "Smooth Scrolling "
209229 control = {
210230 < 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 }
213233 onChange = { ( _ , val ) => {
214- this . touchMonacoProperty ( 'cursorStyle ' , val )
234+ this . touchMonacoProperty ( 'smoothScrolling ' , val )
215235 } }
216236 />
217237 }
218238 />
219239 < SettingsProperty
220- key = "contextMenu "
221- title = "Context Menu "
240+ key = "minimap "
241+ title = "Mini Map "
222242 control = {
223243 < 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 }
226246 onChange = { ( _ , val ) => {
227- this . touchMonacoProperty ( 'contextMenu ' , val )
247+ this . touchMonacoProperty ( 'minimap ' , val )
228248 } }
229249 />
230250 }
231251 />
232252 < SettingsProperty
233- key = "smoothScroll "
234- title = "Smooth Scrolling "
253+ key = "selectOnGutterClick "
254+ title = "Select On Gutter Click "
235255 control = {
236256 < 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 }
239259 onChange = { ( _ , val ) => {
240- this . touchMonacoProperty ( 'smoothScrolling ' , val )
260+ this . touchMonacoProperty ( 'cursorStyle ' , val )
241261 } }
242262 />
243263 }
244264 />
245265 < SettingsProperty
246- key = "mouseWheelZoom "
247- title = "Mouse Wheel Zoom "
266+ key = "contextMenu "
267+ title = "Context Menu "
248268 control = {
249269 < 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 }
252272 onChange = { ( _ , val ) => {
253- this . touchMonacoProperty ( 'mouseWheelZoom ' , val )
273+ this . touchMonacoProperty ( 'contextMenu ' , val )
254274 } }
255275 />
256276 }
0 commit comments