Use CodeMirror editor
This commit is contained in:
@@ -16,12 +16,30 @@ go build .
|
||||
make deploy
|
||||
```
|
||||
|
||||
### Editor bundle (the one build-pipeline exception)
|
||||
|
||||
The page editor uses CodeMirror 6, vendored as a single pre-built IIFE at
|
||||
`assets/editor/vendor/codemirror.bundle.js` and embedded via `embed.FS`. This is
|
||||
the **only** deliberate exception to the "no build pipeline" rule below — it is a
|
||||
one-time, committed artifact, not a runtime build. `go build` / `make deploy`
|
||||
never touch Node and only consume the committed bundle.
|
||||
|
||||
Regenerate the bundle **only** when upgrading the `@codemirror/*` versions:
|
||||
|
||||
```bash
|
||||
# bump versions in editor-build/package.json first, then:
|
||||
make editor # runs `npm ci && npm run build` in editor-build/, rewrites the vendored bundle
|
||||
```
|
||||
|
||||
Commit the regenerated `codemirror.bundle.js` and the updated
|
||||
`editor-build/package-lock.json`. `editor-build/node_modules/` is gitignored.
|
||||
|
||||
## HTTP API Surface
|
||||
|
||||
| Method | Path | Behaviour |
|
||||
|--------|------|-----------|
|
||||
| GET | `/{path}/` | If folder exists: render `index.md` + list contents. If not: show empty create prompt. |
|
||||
| GET | `/{path}/?edit` | Mobile-friendly editor with `index.md` content in a textarea |
|
||||
| GET | `/{path}/?edit` | CodeMirror 6 editor initialized with `index.md` content |
|
||||
| POST | `/{path}` | Write `index.md` to disk; creates the folder if it does not exist yet |
|
||||
|
||||
Non-existent paths without a trailing slash redirect to the slash form (GET only — POSTs
|
||||
@@ -49,7 +67,7 @@ Prefer separate, human-readable `.html` files over inlined HTML strings in Go. E
|
||||
|
||||
## Frontend Rules
|
||||
|
||||
- Vanilla JS only — no frameworks, no build pipeline
|
||||
- Vanilla JS only — no frameworks, no build pipeline (the single exception is the vendored CodeMirror editor bundle; see Build & Deploy)
|
||||
- Each feature gets its own JS file; global behaviour goes in `global-shortcuts.js`
|
||||
- Do not inline JS in templates or merge unrelated features into one file
|
||||
- `ALT+SHIFT` is the modifier for all keyboard shortcuts — do not introduce others
|
||||
|
||||
Reference in New Issue
Block a user