diff --git a/dinky-web/src/components/CustomEditor/CodeEdit/function.tsx b/dinky-web/src/components/CustomEditor/CodeEdit/function.tsx index fae3acce0f..934f0f385f 100644 --- a/dinky-web/src/components/CustomEditor/CodeEdit/function.tsx +++ b/dinky-web/src/components/CustomEditor/CodeEdit/function.tsx @@ -26,7 +26,9 @@ import ITextModel = editor.ITextModel; import ProviderResult = languages.ProviderResult; import CompletionList = languages.CompletionList; import CompletionItem = languages.CompletionItem; +import {loader} from "@monaco-editor/react"; // 导入 lodash +loader.config({ monaco }); /** * get keyWordJson from {@link ./keyword.json} diff --git a/dinky-web/src/components/CustomEditor/CodeEdit/index.tsx b/dinky-web/src/components/CustomEditor/CodeEdit/index.tsx index 3e8e11412c..fee34bcbe6 100644 --- a/dinky-web/src/components/CustomEditor/CodeEdit/index.tsx +++ b/dinky-web/src/components/CustomEditor/CodeEdit/index.tsx @@ -25,7 +25,7 @@ import { handleInitEditorAndLanguageOnBeforeMount } from '@/components/CustomEdi import { StateType } from '@/pages/DataStudio/model'; import { MonacoEditorOptions, SuggestionInfo } from '@/types/Public/data'; import { convertCodeEditTheme } from '@/utils/function'; -import { Editor, Monaco, OnChange } from '@monaco-editor/react'; +import {Editor, loader, Monaco, OnChange} from '@monaco-editor/react'; import { connect } from '@umijs/max'; import useMemoCallback from 'rc-menu/es/hooks/useMemoCallback'; import { memo, useCallback, useRef } from 'react'; @@ -35,6 +35,8 @@ import CompletionContext = languages.CompletionContext; import CompletionList = languages.CompletionList; import ProviderResult = languages.ProviderResult; +loader.config({ monaco }); + let provider = { dispose: () => {} }; diff --git a/dinky-web/src/components/CustomEditor/CodeShow/index.tsx b/dinky-web/src/components/CustomEditor/CodeShow/index.tsx index deaecdc473..b2a77e1107 100644 --- a/dinky-web/src/components/CustomEditor/CodeShow/index.tsx +++ b/dinky-web/src/components/CustomEditor/CodeShow/index.tsx @@ -28,8 +28,12 @@ import { EditorLanguage } from 'monaco-editor/esm/metadata'; import FullscreenBtn from '@/components/CustomEditor/FullscreenBtn'; import { handleInitEditorAndLanguageOnBeforeMount } from '@/components/CustomEditor/function'; -import { Editor, Monaco } from '@monaco-editor/react'; +import {Editor, loader, Monaco} from '@monaco-editor/react'; import { CSSProperties, useRef, useState } from 'react'; +import * as monaco from "monaco-editor"; + +loader.config({ monaco }); + export type CodeShowFormProps = { height?: string | number; diff --git a/dinky-web/src/pages/DataStudio/MiddleContainer/StudioEditor/DiffModal.tsx b/dinky-web/src/pages/DataStudio/MiddleContainer/StudioEditor/DiffModal.tsx index ba69b07fe0..c5f1df43ca 100644 --- a/dinky-web/src/pages/DataStudio/MiddleContainer/StudioEditor/DiffModal.tsx +++ b/dinky-web/src/pages/DataStudio/MiddleContainer/StudioEditor/DiffModal.tsx @@ -24,10 +24,13 @@ import { } from '@/pages/DataStudio/MiddleContainer/StudioEditor/constants'; import { convertCodeEditTheme } from '@/utils/function'; import { l } from '@/utils/intl'; -import { DiffEditor } from '@monaco-editor/react'; +import {DiffEditor, loader} from '@monaco-editor/react'; import { Col, Modal, Row, Space, Table, Tabs, Typography } from 'antd'; import React, { memo } from 'react'; import styles from './index.less'; +import * as monaco from "monaco-editor"; + +loader.config({ monaco }); const { Text, Link } = Typography;