diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 505dd6b1f76..ae61236bf15 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -20,7 +20,7 @@ jobs: - uses: pnpm/action-setup@v2 name: Install pnpm with: - version: 8 + version: 9.1.4 run_install: false - name: Get pnpm store directory @@ -45,4 +45,4 @@ jobs: - name: Build run: pnpm run build - \ No newline at end of file + diff --git a/public/monaco-editor b/public/monaco-editor new file mode 120000 index 00000000000..dea96340e49 --- /dev/null +++ b/public/monaco-editor @@ -0,0 +1 @@ +../node_modules/.pnpm/monaco-editor@0.50.0 \ No newline at end of file diff --git a/src/containers/Editor/components/TextEditor.tsx b/src/containers/Editor/components/TextEditor.tsx index cd9ae836541..15e1245a6ee 100644 --- a/src/containers/Editor/components/TextEditor.tsx +++ b/src/containers/Editor/components/TextEditor.tsx @@ -1,13 +1,19 @@ import React from "react"; import { LoadingOverlay } from "@mantine/core"; import styled from "styled-components"; -import Editor, { type EditorProps, loader, useMonaco } from "@monaco-editor/react"; +import Editor, { type EditorProps, useMonaco, loader } from "@monaco-editor/react"; import useConfig from "src/store/useConfig"; import useFile from "src/store/useFile"; +let monaco_url = "./monaco-editor/node_modules/monaco-editor/min/vs"; + +if (window.navigator.onLine) { + monaco_url = "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.34.0/min/vs"; +} + loader.config({ paths: { - vs: "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.34.0/min/vs", + vs: monaco_url, }, });