This commit is contained in:
Mateusz Gruszczyński committed 2026-11-28 17:36:53 +01:00
1 parent 5b6d4a7903
commit 4d1087e357
160 files changed
+2407 -1933

No files matched your search

-8
View File
@@ -8,11 +8,6 @@
const CLOUDFLARE_KINDS = ["cloudflare", "cloudflare_welcome", "cloudflare_placeholder"];
const PAGE_KIND_CARDS = [["", "pageInherit", "pageKindInheritHelp"], ["welcome", "pageWelcome", "notfoundKindWelcomeHelp"], ["builtin", "pageBuiltin", "notfoundKindBuiltinHelp"], ["cloudflare", "notfoundKindCloudflare", "notfoundKindCloudflareHelp"], ["empty", "pageEmpty", "notfoundKindEmptyHelp"], ["html", "pageHtml", "notfoundKindHtmlHelp"]];
let pageCardSerial = 0;
// One default-response slot rendered as a compact row: the summary line shows
// the slot, when it is used and its current response; the selected row opens
// its controls (response type chips, Cloudflare variant, status, own HTML).
// options: slot (preview/saved HTML key), vhostId, scope, title (literal row
// title), whenKey, naturalStatus, onSelect, onChange.
function pageEditor(parent, key, value = null, options = {}) {
const row = el("div", undefined, "page-editor"), heading = options.title ? el("b", options.title, "page-label") : label("b", key, "page-label");
const summary = el("button", undefined, "page-editor-summary"); summary.type = "button"; summary.setAttribute("aria-expanded", "false");
@@ -31,7 +26,6 @@
file.type = "file"; file.accept = ".html,.htm,text/html,text/plain"; file.setAttribute("aria-label", t("pageUploadHtml"));
const source = el("div", undefined, "page-source"); source.append(label("span", "pageUploadHtml", "fine"), file, html);
const controls = el("div", undefined, "page-editor-controls"); controls.hidden = true;
// Chips drive the (hidden) select, which stays the single source of truth.
const name = `page-kind-${++pageCardSerial}`, chips = el("div", undefined, "page-kind-chips"); chips.setAttribute("role", "radiogroup"); chips.setAttribute("aria-label", t(key));
for (const [kind, titleKey, helpKey] of PAGE_KIND_CARDS) {
const chip = el("label", undefined, "page-kind-chip"), radio = el("input"); radio.type = "radio"; radio.name = name; radio.value = kind;
@@ -87,8 +81,6 @@
sync();
return api;
}
// One shared preview for all slots of an editor: the selected slot is shown
// through the sandboxed /api/pages/preview (saved HTML for custom pages).
function previewPane(parent, savedPage) {
const pane = el("aside", undefined, "page-preview-pane"), headRow = el("div", undefined, "page-preview-head"), titleNode = el("strong", ""), open = el("a", t("notfoundPreviewOpen"), "page-preview-open");
open.dataset.i18n = "notfoundPreviewOpen"; open.target = "_blank"; open.rel = "noopener noreferrer";