| 123456789101112131415161718192021 |
- import * as monaco from 'monaco-editor'
- export function createEditor(
- el: HTMLElement,
- options: monaco.editor.IStandaloneEditorConstructionOptions,
- ) {
- return monaco.editor.create(el, {
- // 默认选项
- automaticLayout: true,
- minimap: { enabled: true },
- scrollBeyondLastLine: false,
- fontSize: 13,
- // glyphMargin: true,
- renderValidationDecorations: 'on',
- ...options,
- })
- }
- export function createModel(value: string, language: string, uri?: string) {
- return monaco.editor.createModel(value, language, uri ? monaco.Uri.parse(uri) : undefined)
- }
|