Skip to content
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
1 change: 1 addition & 0 deletions frontend/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"js-confetti": "^0.13.1",
"lodash": "^4.18.1",
"lucide-react": "^1.8.0",
"monaco-editor": "^0.55.1",
"monaco-themes": "^0.4.8",
"ms": "^2.1.3",
"posthog-js": "^1.369.2",
Expand Down
32 changes: 26 additions & 6 deletions frontend/app/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion frontend/app/src/components/v1/ui/code-editor.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import CopyToClipboard from './copy-to-clipboard';
import { useTheme } from '@/components/hooks/use-theme';
import '@/lib/monaco-environment';
import { cn } from '@/lib/utils';
import Editor, { Monaco, OnMount } from '@monaco-editor/react';
import { useCallback, useEffect, useId, useRef } from 'react';
Expand Down Expand Up @@ -49,7 +50,8 @@ export function CodeEditor({
const existingSchemas = existingOptions.schemas || [];

const otherSchemas = existingSchemas.filter(
(s) => !s.fileMatch?.includes(modelPath),
(s: (typeof existingSchemas)[number]) =>
!s.fileMatch?.includes(modelPath),
);

const newSchemas = hasJsonSchema
Expand Down
19 changes: 19 additions & 0 deletions frontend/app/src/lib/monaco-environment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Bundles Monaco locally instead of letting @monaco-editor/react fetch it
// from cdn.jsdelivr.net at runtime, which breaks air-gapped/self-hosted
// deployments. Importing this module configures both the editor's worker
// environment and the loader before any <Editor /> instance mounts.
import { loader } from '@monaco-editor/react';
import * as monaco from 'monaco-editor';
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker';

self.MonacoEnvironment = {
getWorker(_workerId, label) {
if (label === 'json') {
return new jsonWorker();
}
return new editorWorker();
},
};

loader.config({ monaco });