Skip to content

Commit

Permalink
[Fix][Web]fix monaco use cdn,but should use local (#2701)
Browse files Browse the repository at this point in the history
* fix_monaco_cdn

* added some loader

---------

Co-authored-by: Zzm0809 <[email protected]>
  • Loading branch information
zackyoungh and Zzm0809 authored Dec 20, 2023
1 parent bed180d commit 64bb8ae
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions dinky-web/src/components/CustomEditor/CodeEdit/function.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 3 additions & 1 deletion dinky-web/src/components/CustomEditor/CodeEdit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -35,6 +35,8 @@ import CompletionContext = languages.CompletionContext;
import CompletionList = languages.CompletionList;
import ProviderResult = languages.ProviderResult;

loader.config({ monaco });

let provider = {
dispose: () => {}
};
Expand Down
6 changes: 5 additions & 1 deletion dinky-web/src/components/CustomEditor/CodeShow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 64bb8ae

Please sign in to comment.