mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-06 00:47:52 +00:00
fix(editor): bundle Monaco locally to fix stuck Loading state and CSP block
- Add monaco-editor to frontend deps and configure @monaco-editor/react
to use the local bundle via loader.config({ monaco }) instead of
fetching from cdn.jsdelivr.net (blocked by CSP scriptSrc: self)
- Wire editorWorker via Vite ?worker syntax — blob: URLs already
permitted by existing workerSrc CSP directive, no CSP changes needed
- fix(ci): use DOCS_REPO_TOKEN in release-please so tag creation
cascades to docker-publish.yml (GITHUB_TOKEN cannot trigger workflows)
- fix(ci): auto-merge screenshots PR via gh pr merge --auto --squash
This commit is contained in:
@@ -3,6 +3,20 @@ import { createRoot } from 'react-dom/client'
|
||||
import './index.css'
|
||||
import App from './App.tsx'
|
||||
import ErrorBoundary from './components/ErrorBoundary.tsx'
|
||||
import * as monaco from 'monaco-editor'
|
||||
import { loader } from '@monaco-editor/react'
|
||||
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'
|
||||
|
||||
// Use the locally bundled Monaco instead of fetching from cdn.jsdelivr.net.
|
||||
// The CSP (scriptSrc: 'self') blocks external CDN scripts; bundling avoids
|
||||
// that entirely. Sencho only needs YAML/plaintext so the base editorWorker
|
||||
// covers all language modes — no additional language workers required.
|
||||
window.MonacoEnvironment = {
|
||||
getWorker(_workerId: string, _label: string): Worker {
|
||||
return new editorWorker()
|
||||
},
|
||||
}
|
||||
loader.config({ monaco })
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
<StrictMode>
|
||||
|
||||
Reference in New Issue
Block a user