Code Editor (CodeMirror)

The owned CodeMirror 6 mount at @/components/codemirror — the generic editable text/code surface, sibling of @/components/monaco. It backs the workbench markdown editor and is the editable fallback for any text format.


Language

Editing is live — try typing, multi-cursor (Alt+click), search (Cmd/Ctrl+F), and toggle the app theme to see the editor follow it.


Serialized output

handle.getValue(), updated on every onDocChange — identity serialization, so this is exactly what a save would write.

# CodeMirror mount

A *thin, owned* binding over **CodeMirror 6** — no third-party wrapper.

- language resolved lazily from the filename
- theme follows the app (light / One Dark)
- `readOnly` and language swap via compartments — no remount

```ts
const view = new EditorView({ state, parent });
```