diff --git a/SW.Bitween.Web/ClientApp/package.json b/SW.Bitween.Web/ClientApp/package.json index 9d82fbce..b18dda7a 100644 --- a/SW.Bitween.Web/ClientApp/package.json +++ b/SW.Bitween.Web/ClientApp/package.json @@ -16,6 +16,7 @@ "@fontsource-variable/instrument-sans": "^5.2.8", "@fontsource-variable/jetbrains-mono": "^5.2.8", "@headlessui/react": "^2.2.10", + "@monaco-editor/loader": "^1.7.0", "@monaco-editor/react": "^4.7.0", "@tailwindcss/vite": "^4.3.2", "@tanstack/react-query": "^5.101.2", diff --git a/SW.Bitween.Web/ClientApp/src/components/mapper/ManualEditor.tsx b/SW.Bitween.Web/ClientApp/src/components/mapper/ManualEditor.tsx index c645818a..a21078cd 100644 --- a/SW.Bitween.Web/ClientApp/src/components/mapper/ManualEditor.tsx +++ b/SW.Bitween.Web/ClientApp/src/components/mapper/ManualEditor.tsx @@ -1,4 +1,5 @@ import React, { lazy, Suspense, useEffect, useRef } from "react"; +import loader from "@monaco-editor/loader"; import { useMappingEditorDispatch, useMappingEditorState, @@ -9,6 +10,10 @@ import { } from "../../lib/mapping/MappingEditorContext"; import { generateScriban, parseScriban } from "../../lib/mapping/scribanGenerator"; +// Pinned to an exact version so the CSP entries in Startup.cs (which allow only +// this path, not all of cdn.jsdelivr.net) stay valid — bump both together. +loader.config({ paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs" } }); + // Monaco is heavy — lazy-load it so it stays out of the main bundle. const MonacoEditor = lazy(() => import("@monaco-editor/react")); diff --git a/SW.Bitween.Web/ClientApp/src/components/ui/basics.tsx b/SW.Bitween.Web/ClientApp/src/components/ui/basics.tsx index ed84d77c..4a33a671 100644 --- a/SW.Bitween.Web/ClientApp/src/components/ui/basics.tsx +++ b/SW.Bitween.Web/ClientApp/src/components/ui/basics.tsx @@ -30,7 +30,7 @@ export function Button({