Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use monaco-editor node package instead of CDN for offline editing #442

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -45,4 +45,4 @@ jobs:
- name: Build
run: pnpm run build



1 change: 1 addition & 0 deletions public/monaco-editor
10 changes: 8 additions & 2 deletions src/containers/Editor/components/TextEditor.tsx
Original file line number Diff line number Diff line change
@@ -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,
},
});

Expand Down
Loading