Skip to content

Commit 00176d0

Browse files
committed
feat: expose editorOptions.monacoOptions
closes #277, closes #232
1 parent 6c298f8 commit 00176d0

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/Repl.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
injectKeyProps,
1010
} from './types'
1111
import EditorContainer from './editor/EditorContainer.vue'
12+
import type * as monaco from 'monaco-editor-core'
1213
1314
export interface Props {
1415
theme?: 'dark' | 'light'
@@ -37,6 +38,7 @@ export interface Props {
3738
}
3839
editorOptions?: {
3940
showErrorText?: string
41+
monacoOptions?: monaco.editor.IStandaloneEditorConstructionOptions
4042
}
4143
}
4244

src/monaco/Monaco.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ const emit = defineEmits<{
3535
const containerRef = ref<HTMLDivElement>()
3636
const ready = ref(false)
3737
const editor = shallowRef<monaco.editor.IStandaloneCodeEditor>()
38-
const { store, autoSave, theme: replTheme } = inject(injectKeyProps)!
38+
const {
39+
store,
40+
autoSave,
41+
theme: replTheme,
42+
editorOptions,
43+
} = inject(injectKeyProps)!
3944
4045
initMonaco(store.value)
4146
@@ -67,6 +72,7 @@ onMounted(async () => {
6772
enabled: false,
6873
},
6974
fixedOverflowWidgets: true,
75+
...editorOptions.value.monacoOptions,
7076
})
7177
editor.value = editorInstance
7278

test/main.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ const App = {
6767
},
6868
// showCompileOutput: false,
6969
// showImportMap: false
70+
editorOptions: {
71+
monacoOptions: {
72+
// wordWrap: 'on',
73+
},
74+
},
7075
})
7176
},
7277
}

0 commit comments

Comments
 (0)