host: revert legacy-editor shims — clean over fancy, 181/181
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 20s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 20s
Pull out the debt that revived the legacy editor: removed kg-compat.sx (uncommitted bare->namespaced kg-card aliases), the ./blog container mount, the legacy sx-editor.js + hardcoded asset URLs + ~editor/sx-editor-styles reuse at /new, and the blog/sx preloads. /new is now a clean minimal form. Finding that reshapes Phase 5: render-page (5.1) renders STATIC component trees but is NOT the full evaluator — a component with a data loop ((map fn items) over (unquote data)) errors 'Not callable: nil'. So clean dynamic component pages + a native island editor need the aser SSR pipeline (5.2), not just render-page. Posts still render via per-block guarded render-page; unsupported editor cards (~kg-md) show placeholders by design (no alias shim). All endpoints 200, boot clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -116,43 +116,25 @@
|
||||
|
||||
(define host/blog-index (fn (req) (host/ok (host/blog-list))))
|
||||
|
||||
;; ── create page (GET /new) — the real WYSIWYG block editor ──────────
|
||||
;; Mounts the self-contained sx-editor.js (Ghost/Koenig-style block editor) that
|
||||
;; serializes the visual edit to `sx_content`. Assets (sx-browser.js for Sx.parse,
|
||||
;; sx-editor.js, editor.css) are referenced from the docs static host
|
||||
;; (sx.rose-ash.com/static/scripts) — no host static-serving needed. On submit the
|
||||
;; handle's getSx() fills the hidden sx_content field, then it POSTs to /new.
|
||||
;; (This reuses the legacy JS editor; a native SX-island editor is the future.)
|
||||
(define host/blog--asset "https://sx.rose-ash.com/static/scripts")
|
||||
;; ── create page (GET /new) — clean minimal form ────────────────────
|
||||
;; A plain create form: title + sx_content (SX element markup) + status. No
|
||||
;; legacy JS editor, no external assets, no shims. The rich WYSIWYG is a future
|
||||
;; native SX-island editor served via the Phase-5.2 SSR pipeline (render-page
|
||||
;; alone can't render dynamic-logic component bodies — proven). Posts to /new.
|
||||
(define host/blog-new-form
|
||||
(fn (req)
|
||||
(dream-html
|
||||
(str
|
||||
"<!doctype html><html><head><meta charset=\"utf-8\"><title>New post</title>"
|
||||
;; FontAwesome for the editor's +/slash-menu icons.
|
||||
"<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css\">"
|
||||
;; The sx-editor's own styles (.sx-*), rendered from its component via 5.1.
|
||||
(render-page (quote (~editor/sx-editor-styles)))
|
||||
"<style>body{max-width:768px;margin:2rem auto;padding:0 1rem;font-family:system-ui}"
|
||||
"#title-input{width:100%;font-size:1.9em;font-weight:700;border:none;outline:none;margin:.5rem 0}"
|
||||
".bar{display:flex;gap:1rem;align-items:center;margin-top:1.5rem;border-top:1px solid #eee;padding-top:1rem}</style>"
|
||||
"</head><body>"
|
||||
"<form id=\"post-new-form\" method=\"post\" action=\"/new\">"
|
||||
"<input id=\"title-input\" name=\"title\" placeholder=\"Post title\" autocomplete=\"off\">"
|
||||
"<input type=\"hidden\" id=\"sx-content-input\" name=\"sx_content\" value=\"\">"
|
||||
"<div id=\"sx-editor\"></div>"
|
||||
"<div class=\"bar\">"
|
||||
"<select name=\"status\"><option value=\"draft\">Draft</option>"
|
||||
"<option value=\"published\" selected>Published</option></select>"
|
||||
"<button type=\"submit\">Publish</button>"
|
||||
"<a href=\"/\">all posts</a></div>"
|
||||
"</form>"
|
||||
"<script src=\"" host/blog--asset "/sx-browser.js\"></script>"
|
||||
"<script src=\"" host/blog--asset "/sx-editor.js\"></script>"
|
||||
"<script>(function(){var h=SxEditor.mount('sx-editor',{});"
|
||||
"document.getElementById('post-new-form').addEventListener('submit',function(){"
|
||||
"document.getElementById('sx-content-input').value=h.getSx();});})();</script>"
|
||||
"</body></html>"))))
|
||||
(host/blog--page "New post"
|
||||
(str
|
||||
"<h1>New post</h1>"
|
||||
"<form method=\"post\" action=\"/new\">"
|
||||
"<p><input name=\"title\" placeholder=\"Title\" style=\"font-size:1.4em;width:100%\"></p>"
|
||||
"<p><textarea name=\"sx_content\" rows=\"12\" style=\"width:100%;font-family:monospace\" "
|
||||
"placeholder=\"(p "Your post as SX markup")\"></textarea></p>"
|
||||
"<p><select name=\"status\"><option value=\"draft\">Draft</option>"
|
||||
"<option value=\"published\">Published</option></select> "
|
||||
"<button type=\"submit\">Publish</button></p>"
|
||||
"</form><p><a href=\"/\">← all posts</a></p>")))))
|
||||
|
||||
;; ── write handlers ──────────────────────────────────────────────────
|
||||
;; POST /new — form-urlencoded ingest (the editor's submit shape: title,
|
||||
|
||||
@@ -63,8 +63,6 @@ MODULES=(
|
||||
"lib/persist/durable.sx"
|
||||
"spec/render.sx"
|
||||
"web/adapter-html.sx"
|
||||
"blog/sx/layouts.sx"
|
||||
"blog/sx/editor.sx"
|
||||
"lib/dream/types.sx"
|
||||
"lib/dream/json.sx"
|
||||
"lib/dream/auth.sx"
|
||||
|
||||
@@ -68,8 +68,6 @@ MODULES=(
|
||||
"lib/persist/durable.sx"
|
||||
"spec/render.sx"
|
||||
"web/adapter-html.sx"
|
||||
"blog/sx/layouts.sx"
|
||||
"blog/sx/editor.sx"
|
||||
"lib/dream/types.sx"
|
||||
"lib/dream/json.sx"
|
||||
"lib/dream/auth.sx"
|
||||
|
||||
Reference in New Issue
Block a user