mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(site): Load monaco locally (#7092)
This commit is contained in:
@@ -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,
|
||||
() => {
|
||||
//
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user