@pramen/cms-editor 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/dist/index.html +12 -0
- package/dist/main.c43qkeax.js +339 -0
- package/package.json +28 -0
- package/src/api.ts +106 -0
- package/src/app.tsx +688 -0
- package/src/fields.tsx +212 -0
- package/src/main.tsx +11 -0
- package/src/styles.ts +108 -0
- package/src/types.ts +118 -0
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @pramen/cms-editor
|
|
2
|
+
|
|
3
|
+
A **visual block/page editor** for [`@pramen/cms`](../cms) — a standalone React SPA that
|
|
4
|
+
talks to the CMS handlers over HTTP. It mutates through the *semantic* handlers
|
|
5
|
+
(`addBlock`/`updateBlock`/`reorderRegion`/`publishPage`/…), so field validation, region
|
|
6
|
+
allow-lists, and the review/publish gates are all enforced server-side.
|
|
7
|
+
|
|
8
|
+
## What it does
|
|
9
|
+
|
|
10
|
+
- **Page list** + create (pick a content type).
|
|
11
|
+
- **Region canvas:** each region (from the content type) lists its blocks; a palette adds
|
|
12
|
+
blocks, filtered by the region's `allowedTypes`. Reorder (↑/↓) and remove.
|
|
13
|
+
- **Schema-driven field forms:** one input per `FieldDefinition` type —
|
|
14
|
+
text/textarea/richtext/url/number/boolean/**select**/**media** (with an upload+pick media
|
|
15
|
+
picker)/**repeater**/**group** (recursively composed). Draft blocks may be incomplete;
|
|
16
|
+
required fields are enforced at publish, not while editing.
|
|
17
|
+
- **Inspector tabs:** Settings, **SEO** (meta/canonical/robots/OG), **Workflow**
|
|
18
|
+
(submit → review → approve/reject/publish, role-gated), **i18n** (translations), **Audit** trail.
|
|
19
|
+
|
|
20
|
+
## Run it
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
bun --cwd packages/cms-editor run build # → dist/ (index.html + hashed JS)
|
|
24
|
+
bun --cwd packages/cms-editor run dev # watch + preview on http://localhost:5175
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
It's a **standalone static SPA** (no server-package dependency — local types + `fetch`).
|
|
28
|
+
Deploy `dist/` anywhere; it talks cross-origin to your Worker, so set `CORS_ORIGINS` to allow
|
|
29
|
+
the editor's origin. On first load, paste your Worker base URL, tenant, and an
|
|
30
|
+
**editor/reviewer JWT**. (Co-hosting on the Worker via an `assets` binding is a possible
|
|
31
|
+
follow-up.)
|
|
32
|
+
|
|
33
|
+
## Status
|
|
34
|
+
|
|
35
|
+
Verified end-to-end against a live example server (connect → create/open a page → add blocks
|
|
36
|
+
in regions → edit fields → save → publish; confirmed the round-trip through the content API).
|
|
37
|
+
Not yet browser-QA'd against a real production project — that's the integration phase. Rough
|
|
38
|
+
edges: no HTML5 drag-and-drop yet (reorder is ↑/↓ buttons), no rendered live-preview pane (the
|
|
39
|
+
canvas is structural; a rendered preview needs the project's block components), and title/slug
|
|
40
|
+
editing needs a future `updatePage` handler.
|
package/dist/index.html
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>pramen · cms editor</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="app"></div>
|
|
10
|
+
<script type="module" src="./main.c43qkeax.js"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|