Skip to content

Commit 7393181

Browse files
ioedeveloperAniket-Engg
authored andcommitted
Restore editor wrap option
1 parent 2119589 commit 7393181

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

libs/remix-ui/editor/src/lib/actions/editor.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
import { Registry } from '@remix-project/remix-lib';
23
import { monacoTypes } from '@remix-ui/editor';
34
import { commitChange } from '@remix-ui/git';
45
export interface Action {
@@ -115,6 +116,16 @@ export const reducerActions = (models = initialState, action: Action) => {
115116
}
116117

117118
export const reducerListener = (plugin, dispatch, monaco, editors: any[], events) => {
119+
const config = Registry.getInstance().get('config').api
120+
const wordWrap = config.get('settings/text-wrap')
121+
122+
dispatch({
123+
type: 'SET_WORDWRAP',
124+
payload: { wrap: wordWrap },
125+
monaco,
126+
editors
127+
})
128+
118129
plugin.on('editor', 'addModel', (value, language, uri, readOnly) => {
119130
dispatch({
120131
type: 'ADD_MODEL',
@@ -192,7 +203,7 @@ export const reducerListener = (plugin, dispatch, monaco, editors: any[], events
192203
})
193204
})
194205

195-
plugin.on('editor', 'setWordWrap', (wrap) => {
206+
plugin.on('settings', 'textWrapChoiceUpdated', (wrap) => {
196207
dispatch({
197208
type: 'SET_WORDWRAP',
198209
payload: { wrap },

libs/remix-ui/settings/src/lib/remix-ui-settings.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ const settingsSections: SettingsSection[] = [
5454
name: 'display-errors',
5555
label: 'settings.displayErrorsText',
5656
type: 'toggle'
57+
},{
58+
name: 'text-wrap',
59+
label: 'settings.wordWrapText',
60+
type: 'toggle'
5761
}, {
5862
name: 'personal-mode',
5963
label: 'settings.enablePersonalModeText',

libs/remix-ui/settings/src/lib/settings-section.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const SettingsSectionUI: React.FC<SettingsSectionUIProps> = ({ plugin, se
5050
dispatch({ type: 'SET_TOAST_MESSAGE', payload: { value: 'Credentials removed' } })
5151
}
5252
if (name === 'copilot/suggest/activate') plugin.emit('copilotChoiceUpdated', newValue)
53+
if (name === 'text-wrap') plugin.emit('textWrapChoiceUpdated', newValue)
5354
} else {
5455
console.error('Setting does not exist: ', name)
5556
}

0 commit comments

Comments
 (0)