2024-10-22 16:33:12: merge [main:c526b811773c7f55cd6092d974e8fc8b4847e75c];
This commit is contained in:
1 parent
d9543c4a24
commit
a1c96ab2e7
8 files changed
+145
-145
No files matched your search
@@ -1,9 +1,4 @@
|
||||
import Editor, { loader } from '@monaco-editor/react'
|
||||
import * as monaco from 'monaco-editor'
|
||||
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'
|
||||
import cssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker'
|
||||
import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker'
|
||||
import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker'
|
||||
import Editor from '@monaco-editor/react'
|
||||
import { FC, useContext } from 'react'
|
||||
|
||||
import { ConfigurationEditorPropsType } from '@pages/ConfigurationEditorPage/ConfigurationEditor.type.ts'
|
||||
@@ -11,8 +6,6 @@ import { ConfigType } from '@pages/ModulesPage/module.type.ts'
|
||||
|
||||
import { Context } from '@stores/index.tsx'
|
||||
|
||||
import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker'
|
||||
|
||||
const ConfigurationEditorCode: FC<ConfigurationEditorPropsType> = ({
|
||||
setDisableBtn = () => {},
|
||||
bufConfig,
|
||||
@@ -20,28 +13,6 @@ const ConfigurationEditorCode: FC<ConfigurationEditorPropsType> = ({
|
||||
}) => {
|
||||
const { changeTheme } = useContext(Context)
|
||||
|
||||
self.MonacoEnvironment = {
|
||||
getWorker(_, label) {
|
||||
if (label === 'json') {
|
||||
return new jsonWorker()
|
||||
}
|
||||
if (label === 'css' || label === 'scss' || label === 'less') {
|
||||
return new cssWorker()
|
||||
}
|
||||
if (label === 'html' || label === 'handlebars' || label === 'razor') {
|
||||
return new htmlWorker()
|
||||
}
|
||||
if (label === 'typescript' || label === 'javascript') {
|
||||
return new tsWorker()
|
||||
}
|
||||
return new editorWorker()
|
||||
}
|
||||
}
|
||||
|
||||
loader.config({ monaco })
|
||||
|
||||
loader.init().then()
|
||||
|
||||
const handleChange = (data: string | undefined) => {
|
||||
if (data) {
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user