Files
nocodb/packages/nc-gui/plugins/monaco.ts
Anbarasu a5fc9be175 feat: Formula colouring and improved suggestions (#9072)
* feat: formula language

* feat: formula coloring and ux improvements

* fix: suggestions generation

* fix: handle undefined editor

* fix: handle formula errors

* fix: update imports

* fix: minor corrections

* fix: test corrections

* fix: increase timeout

* fix: clear existing formulas before pasting

* fix: ux improve

* fix: ux improve

* fix: coloring issue

* fix: remove styles

* fix: handle wrapping

* fix: bug fixes

* fix: strict suggestion handling

* fix: update indent strategy

* fix: handle formula in nested state and unbalanced parens

* fix: formula fix

* chore: sync dependencies
2024-07-30 13:47:07 +05:30

24 lines
786 B
TypeScript

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))
}
}
},
}
})