File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed
components/webui/client/src/components/SqlEditor Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 77} from "@monaco-editor/react" ;
88import { language as sqlLanguage } from "monaco-editor/esm/vs/basic-languages/sql/sql.js" ;
99
10+ import "./monaco-config" ;
1011
1112type SqlEditorProps = Omit < EditorProps , "language" > ;
1213
Original file line number Diff line number Diff line change 1+ import { loader } from '@monaco-editor/react' ;
2+ import * as monaco from 'monaco-editor' ;
3+ import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker' ;
4+ import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker' ;
5+ import cssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker' ;
6+ import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker' ;
7+ import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker' ;
8+
9+ // Reference: https://github.com/suren-atoyan/monaco-react?tab=readme-ov-file#use-monaco-editor-as-an-npm-package
10+ self . MonacoEnvironment = {
11+ getWorker ( _ , label ) {
12+ if ( label === 'json' ) {
13+ return new jsonWorker ( ) ;
14+ }
15+ if ( label === 'css' || label === 'scss' || label === 'less' ) {
16+ return new cssWorker ( ) ;
17+ }
18+ if ( label === 'html' || label === 'handlebars' || label === 'razor' ) {
19+ return new htmlWorker ( ) ;
20+ }
21+ if ( label === 'typescript' || label === 'javascript' ) {
22+ return new tsWorker ( ) ;
23+ }
24+ return new editorWorker ( ) ;
25+ } ,
26+ } ;
27+
28+ loader . config ( { monaco } ) ;
Original file line number Diff line number Diff line change 11declare module "monaco-editor/esm/vs/basic-languages/sql/sql.js" {
2- import { languages } from "monaco-editor/esm/vs/editor/editor.api " ;
2+ import { languages } from "monaco-editor" ;
33
44
55 interface SqlLanguageDefinition extends languages . IMonarchLanguage {
You can’t perform that action at this time.
0 commit comments