Skip to content

Commit

Permalink
feat: expose editorOptions.monacoOptions
Browse files Browse the repository at this point in the history
closes #277, closes #232
  • Loading branch information
sxzz committed Aug 27, 2024
1 parent 6c298f8 commit 00176d0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Repl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -37,6 +38,7 @@ export interface Props {
}
editorOptions?: {
showErrorText?: string
monacoOptions?: monaco.editor.IStandaloneEditorConstructionOptions
}
}
Expand Down
8 changes: 7 additions & 1 deletion src/monaco/Monaco.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ const emit = defineEmits<{
const containerRef = ref<HTMLDivElement>()
const ready = ref(false)
const editor = shallowRef<monaco.editor.IStandaloneCodeEditor>()
const { store, autoSave, theme: replTheme } = inject(injectKeyProps)!
const {
store,
autoSave,
theme: replTheme,
editorOptions,
} = inject(injectKeyProps)!
initMonaco(store.value)
Expand Down Expand Up @@ -67,6 +72,7 @@ onMounted(async () => {
enabled: false,
},
fixedOverflowWidgets: true,
...editorOptions.value.monacoOptions,
})
editor.value = editorInstance
Expand Down
5 changes: 5 additions & 0 deletions test/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ const App = {
},
// showCompileOutput: false,
// showImportMap: false
editorOptions: {
monacoOptions: {
// wordWrap: 'on',
},
},
})
},
}
Expand Down

0 comments on commit 00176d0

Please sign in to comment.