Skip to content

Commit

Permalink
don't use cdn for monaco
Browse files Browse the repository at this point in the history
  • Loading branch information
HKalbasi committed Sep 29, 2021
1 parent b41f078 commit 526a32a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
7 changes: 5 additions & 2 deletions ui/frontend/editor/MonacoEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { CommonEditorProps, Position } from '../types';
import MonacoReact, { Monaco } from "@monaco-editor/react";
import { CommonEditorProps } from '../types';
import MonacoReact, { Monaco, loader } from "@monaco-editor/react";
import { connect } from 'react-redux';
import State from '../state';

Expand All @@ -13,6 +13,7 @@ const initMonaco = (monaco: Monaco) => {
monaco.editor.defineTheme('vscode-dark-plus', {
base: 'vs-dark',
inherit: true,
colors: {},
rules: [
{ token: 'keyword.control', foreground: 'C586C0' },
{ token: 'variable', foreground: '9CDCFE' },
Expand Down Expand Up @@ -41,6 +42,8 @@ const mapStateToProps = (state: State) => {

type MonacoEditorProps = CommonEditorProps & PropsFromState;

loader.config({ paths: { vs: '/assets/vs' } });

const MonacoEditor: React.SFC<MonacoEditorProps> = props => {
return (
<MonacoReact
Expand Down
6 changes: 4 additions & 2 deletions ui/frontend/editor/rust_monaco_def.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const config = {
import { languages } from "monaco-editor";

export const config: languages.LanguageConfiguration = {
comments: {
lineComment: '//',
blockComment: ['/*', '*/']
Expand Down Expand Up @@ -29,7 +31,7 @@ export const config = {
}
};

export const grammar = {
export const grammar: languages.IMonarchLanguage = {
// Set defaultToken to invalid to see what you do not tokenize yet
// defaultToken: 'invalid',

Expand Down
1 change: 1 addition & 0 deletions ui/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"history": "^4.6.0",
"isomorphic-fetch": "^3.0.0",
"lodash": "^4.17.0",
"monaco-editor": "^0.28.1",
"prismjs": "^1.6.0",
"qs": "^6.4.0",
"react": "^17.0.1",
Expand Down
1 change: 1 addition & 0 deletions ui/frontend/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ module.exports = function(_, argv) {
new CopyPlugin({
patterns: [
{ from: 'robots.txt', to: '..' },
{ from: 'node_modules/monaco-editor/min/vs', to: 'vs' }
],
}),
new MiniCssExtractPlugin({
Expand Down
5 changes: 5 additions & 0 deletions ui/frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4698,6 +4698,11 @@ mkdirp@1.x, mkdirp@~1.0.4:
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==

monaco-editor@^0.28.1:
version "0.28.1"
resolved "https://registry.yarnpkg.com/monaco-editor/-/monaco-editor-0.28.1.tgz#732788ff2172d59e6d436b206da8cac715413940"
integrity sha512-P1vPqxB4B1ZFzTeR1ScggSp9/5NoQrLCq88fnlNUsuRAP1usEBN4TIpI2lw0AYIZNVIanHk0qwjze2uJwGOHUw==

ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
Expand Down

0 comments on commit 526a32a

Please sign in to comment.