From 87e750c776bd18a4fe734f963d497be79037d5a9 Mon Sep 17 00:00:00 2001 From: stroblme Date: Wed, 28 Oct 2026 17:32:49 +0100 Subject: [PATCH] Code editor: CodeMirror 6 replaces Monaco Node source (Python) and the JSON dialog share one CodeMirror editor with find and replace, autocomplete, folding, indent guides, comment toggle and a JSON lint, themed from the CSS tokens so light and dark follow the .dark class without a second palette. Programmatic value changes no longer fire onChange, blur ignores focus moving into the find bar, readOnly keeps selection and copy. The editor chunk is 470 kB (157 kB gzipped) against 2.7 MB (704 kB) for Monaco, which also pulled in a 1.2 MB JSON mode, two workers and a font. At 4x CPU on slow 4G a node panel is ready in 5.7 s instead of 10.8 s, the JSON dialog in 1.5 s instead of 6.7 s. Typing without a key delay keeps every character. monaco-editor, @monaco-editor/react and the dompurify override are removed. Specs: typed code reaches the node source, a JSON setting saves only text that parses. Docs name Tab and Ctrl-M. --- backend/fluksio/spa.py | 2 +- bun.lock | 61 ++++-- docs/interface/flow-editor.md | 5 +- frontend/package.json | 12 +- frontend/scripts/capture-screenshots.mjs | 2 +- frontend/src/components/Flow/NodeEditor.tsx | 219 ++++++++++++++++---- frontend/src/components/Flow/NodePanel.tsx | 4 +- frontend/src/components/Flow/codeTheme.ts | 199 ++++++++++++++++++ frontend/src/components/Flow/monacoSetup.ts | 81 -------- frontend/src/lib/shortcuts.ts | 4 +- frontend/tests/flows.spec.ts | 84 ++++++++ package.json | 1 - 12 files changed, 531 insertions(+), 143 deletions(-) create mode 100644 frontend/src/components/Flow/codeTheme.ts delete mode 100644 frontend/src/components/Flow/monacoSetup.ts diff --git a/backend/fluksio/spa.py b/backend/fluksio/spa.py index a73c451..91af90b 100644 --- a/backend/fluksio/spa.py +++ b/backend/fluksio/spa.py @@ -31,7 +31,7 @@ def content_security_policy(index_html: str) -> str: The hash is taken from the file being served, so editing the theme script in ``index.html`` cannot leave a stale one behind. - style-src 'unsafe-inline': Monaco, Radix's scroll lock and the toasts insert + style-src 'unsafe-inline': CodeMirror, Radix's scroll lock and the toasts insert