Add CodeMirror-based script editor, verified against real hardware

New Script section: loads the device's current Lua script (GET
/api/script), edits it in a real code editor (CodeMirror 6 with Lua
syntax highlighting via @codemirror/legacy-modes -- no dedicated
@codemirror/lang-lua package exists, verified against the npm
registry), and saves it back (POST /api/script) as raw text, not
JSON, matching the device's endpoint. Not Blockly yet -- that's its
own, much larger task; this is the raw-text step toward it.

Verified end-to-end against a real ESP32-C6: load, edit, save
hot-reloads on-device within one tick, and the change survives a
power cycle.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Ronny Eia
2026-07-12 10:27:13 +02:00
parent 6468dddc05
commit 7bb77a93a7
6 changed files with 286 additions and 2 deletions

View File

@@ -8,6 +8,11 @@
"build": "tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"@codemirror/language": "^6.0.0",
"@codemirror/legacy-modes": "^6.0.0",
"codemirror": "^6.0.0"
},
"devDependencies": {
"typescript": "^5.6.0",
"vite": "^6.0.0"