mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
786 B
24 lines
786 B
4 months ago
|
import EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker&inline'
|
||
|
import JsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker&inline'
|
||
|
|
||
|
export default defineNuxtPlugin(() => {
|
||
|
/**
|
||
|
* Adding monaco editor to Vite
|
||
|
*
|
||
|
* @ts-expect-error */
|
||
|
self.MonacoEnvironment = window.MonacoEnvironment = {
|
||
|
async getWorker(_: any, label: string) {
|
||
|
switch (label) {
|
||
|
case 'json': {
|
||
|
const workerBlob = new Blob([JsonWorker], { type: 'text/javascript' })
|
||
|
return await initWorker(URL.createObjectURL(workerBlob))
|
||
|
}
|
||
|
default: {
|
||
|
const workerBlob = new Blob([EditorWorker], { type: 'text/javascript' })
|
||
|
return await initWorker(URL.createObjectURL(workerBlob))
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
}
|
||
|
})
|