fix(site): Load monaco locally (#7092)

This commit is contained in:
Bruno Quaresma
2023-04-14 13:11:28 +00:00
committed by GitHub
parent 17bb1a1ff1
commit ad665cef91
6 changed files with 51 additions and 29 deletions
+18
View File
@@ -0,0 +1,18 @@
const editor = {
defineTheme: () => {
//
},
create: () => {
return {
dispose: () => {
//
},
}
},
}
const monaco = {
editor,
}
module.exports = monaco
@@ -1,8 +1,11 @@
import { FC } from "react"
import Editor, { DiffEditor } from "@monaco-editor/react"
import Editor, { DiffEditor, loader } from "@monaco-editor/react"
import * as monaco from "monaco-editor"
import { useCoderTheme } from "./coderTheme"
import { makeStyles } from "@material-ui/core/styles"
loader.config({ monaco })
export const SyntaxHighlighter: FC<{
value: string
language: string
@@ -1,10 +1,13 @@
import { useTheme } from "@material-ui/core/styles"
import Editor from "@monaco-editor/react"
import Editor, { loader } from "@monaco-editor/react"
import * as monaco from "monaco-editor"
import { FC, useLayoutEffect, useMemo, useState } from "react"
import { MONOSPACE_FONT_FAMILY } from "theme/constants"
import { hslToHex } from "utils/colors"
import type { editor } from "monaco-editor"
loader.config({ monaco })
export const MonacoEditor: FC<{
value?: string
path?: string
@@ -73,7 +76,7 @@ export const MonacoEditor: FC<{
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Private type in Monaco!
;(editor as any)._standaloneKeybindingService.addDynamicKeybinding(
`-editor.action.insertLineAfter`,
undefined,
monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter,
() => {
//
},