05a6f6aa17
- Install monaco-editor + @guolao/vue-monaco-editor - main.ts: loader.config + MonacoEnvironment worker setup - StringEditor.vue: replace textarea with Monaco editor - JSON syntax highlighting, folding, word wrap - Read-only mode when not editing, auto-detect JSON - Theme follows app theme (vs-dark/vs) - Font size follows app settings
34 lines
965 B
TypeScript
34 lines
965 B
TypeScript
// src/main.ts
|
|
import { createApp } from 'vue'
|
|
import { createPinia } from 'pinia'
|
|
import ElementPlus from 'element-plus'
|
|
import 'element-plus/dist/index.css'
|
|
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
|
import { loader } from '@guolao/vue-monaco-editor'
|
|
import * as monaco from 'monaco-editor'
|
|
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'
|
|
import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker'
|
|
import App from './App.vue'
|
|
import './styles/global.css'
|
|
|
|
// Monaco worker setup for Vite
|
|
self.MonacoEnvironment = {
|
|
getWorker(_, label) {
|
|
if (label === 'json') return new jsonWorker()
|
|
return new editorWorker()
|
|
},
|
|
}
|
|
|
|
// Use local monaco-editor
|
|
loader.config({ monaco })
|
|
|
|
const app = createApp(App)
|
|
app.use(createPinia())
|
|
app.use(ElementPlus, { size: 'small' })
|
|
|
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
|
app.component(key, component)
|
|
}
|
|
|
|
app.mount('#app')
|