diff --git a/src/Repl.vue b/src/Repl.vue index a75773be..9b05795a 100644 --- a/src/Repl.vue +++ b/src/Repl.vue @@ -9,6 +9,7 @@ import { injectKeyProps, } from './types' import EditorContainer from './editor/EditorContainer.vue' +import type * as monaco from 'monaco-editor-core' export interface Props { theme?: 'dark' | 'light' @@ -37,6 +38,7 @@ export interface Props { } editorOptions?: { showErrorText?: string + monacoOptions?: monaco.editor.IStandaloneEditorConstructionOptions } } diff --git a/src/monaco/Monaco.vue b/src/monaco/Monaco.vue index 608d5bd6..797081aa 100644 --- a/src/monaco/Monaco.vue +++ b/src/monaco/Monaco.vue @@ -35,7 +35,12 @@ const emit = defineEmits<{ const containerRef = ref() const ready = ref(false) const editor = shallowRef() -const { store, autoSave, theme: replTheme } = inject(injectKeyProps)! +const { + store, + autoSave, + theme: replTheme, + editorOptions, +} = inject(injectKeyProps)! initMonaco(store.value) @@ -67,6 +72,7 @@ onMounted(async () => { enabled: false, }, fixedOverflowWidgets: true, + ...editorOptions.value.monacoOptions, }) editor.value = editorInstance diff --git a/test/main.ts b/test/main.ts index b10b6f23..79a7beb8 100644 --- a/test/main.ts +++ b/test/main.ts @@ -67,6 +67,11 @@ const App = { }, // showCompileOutput: false, // showImportMap: false + editorOptions: { + monacoOptions: { + // wordWrap: 'on', + }, + }, }) }, }