host: block editor live-swap — :sx-post (not sx-disable) + a Playwright check

The block-editor move/remove controls used :sx-disable "true" (the OLD relate-picker pattern
= plain POST → 303 → full reload). Switched to :sx-post + :sx-target #block-editor + :sx-swap
outerHTML (the current pattern): the click is a text/sx form round-trip through the WASM
engine, the handler returns the re-rendered #block-editor, and it swaps IN PLACE — no reload.

Added lib/host/playwright/{block-editor.spec.js, run-block-check.sh} (the run-picker-check
harness pattern: ephemeral host server + one editable post + the main worktree's chromium).
Verifies the irreducibly-browser behaviour the SX conformance can't see: adding, reordering
(↑), and removing blocks re-render #block-editor live, and the controls RE-BIND on the
content each swap brings in. PASSES (1/1, 16s). blog conformance still 165/165.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-01 05:20:52 +00:00
parent af3d81d108
commit f804a71726
3 changed files with 139 additions and 1 deletions

View File

@@ -1352,8 +1352,11 @@
(fn (slug cslug action dir label)
(let ((url (str "/" slug "/blocks/" cslug "/" action)))
(quasiquote
;; :sx-post (NOT sx-disable) so the click is a text/sx form round-trip through the
;; engine — the handler returns the re-rendered #block-editor and sx-swap="outerHTML"
;; replaces it live (no reload). The explicit :sx-post overrides any boost target.
(form :method "post" :action (unquote url) :style "display:inline;margin:0"
:sx-post (unquote url) :sx-target "#block-editor" :sx-swap "outerHTML" :sx-disable "true"
:sx-post (unquote url) :sx-target "#block-editor" :sx-swap "outerHTML"
(unquote (if (= dir "") "" (quasiquote (input :type "hidden" :name "dir" :value (unquote dir)))))
(button :type "submit" (unquote label)))))))
(define host/blog--block-row