Skip to content

Commit 526a32a

Browse files
committed
don't use cdn for monaco
1 parent b41f078 commit 526a32a

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
lines changed

ui/frontend/editor/MonacoEditor.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
2-
import { CommonEditorProps, Position } from '../types';
3-
import MonacoReact, { Monaco } from "@monaco-editor/react";
2+
import { CommonEditorProps } from '../types';
3+
import MonacoReact, { Monaco, loader } from "@monaco-editor/react";
44
import { connect } from 'react-redux';
55
import State from '../state';
66

@@ -13,6 +13,7 @@ const initMonaco = (monaco: Monaco) => {
1313
monaco.editor.defineTheme('vscode-dark-plus', {
1414
base: 'vs-dark',
1515
inherit: true,
16+
colors: {},
1617
rules: [
1718
{ token: 'keyword.control', foreground: 'C586C0' },
1819
{ token: 'variable', foreground: '9CDCFE' },
@@ -41,6 +42,8 @@ const mapStateToProps = (state: State) => {
4142

4243
type MonacoEditorProps = CommonEditorProps & PropsFromState;
4344

45+
loader.config({ paths: { vs: '/assets/vs' } });
46+
4447
const MonacoEditor: React.SFC<MonacoEditorProps> = props => {
4548
return (
4649
<MonacoReact

ui/frontend/editor/rust_monaco_def.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export const config = {
1+
import { languages } from "monaco-editor";
2+
3+
export const config: languages.LanguageConfiguration = {
24
comments: {
35
lineComment: '//',
46
blockComment: ['/*', '*/']
@@ -29,7 +31,7 @@ export const config = {
2931
}
3032
};
3133

32-
export const grammar = {
34+
export const grammar: languages.IMonarchLanguage = {
3335
// Set defaultToken to invalid to see what you do not tokenize yet
3436
// defaultToken: 'invalid',
3537

ui/frontend/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"history": "^4.6.0",
1313
"isomorphic-fetch": "^3.0.0",
1414
"lodash": "^4.17.0",
15+
"monaco-editor": "^0.28.1",
1516
"prismjs": "^1.6.0",
1617
"qs": "^6.4.0",
1718
"react": "^17.0.1",

ui/frontend/webpack.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ module.exports = function(_, argv) {
133133
new CopyPlugin({
134134
patterns: [
135135
{ from: 'robots.txt', to: '..' },
136+
{ from: 'node_modules/monaco-editor/min/vs', to: 'vs' }
136137
],
137138
}),
138139
new MiniCssExtractPlugin({

ui/frontend/yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -4698,6 +4698,11 @@ [email protected], mkdirp@~1.0.4:
46984698
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
46994699
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==
47004700

4701+
monaco-editor@^0.28.1:
4702+
version "0.28.1"
4703+
resolved "https://registry.yarnpkg.com/monaco-editor/-/monaco-editor-0.28.1.tgz#732788ff2172d59e6d436b206da8cac715413940"
4704+
integrity sha512-P1vPqxB4B1ZFzTeR1ScggSp9/5NoQrLCq88fnlNUsuRAP1usEBN4TIpI2lw0AYIZNVIanHk0qwjze2uJwGOHUw==
4705+
47014706
47024707
version "2.0.0"
47034708
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"

0 commit comments

Comments
 (0)