From 14d408faeb0a951a114c64637cb17058a065d51a Mon Sep 17 00:00:00 2001 From: Anthony Donlon Date: Fri, 21 Nov 2025 09:02:41 +0800 Subject: [PATCH] editor/ui: misc fixes --- editor/resources/index.html | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/editor/resources/index.html b/editor/resources/index.html index 18b1049..2c8d2d5 100644 --- a/editor/resources/index.html +++ b/editor/resources/index.html @@ -136,6 +136,9 @@ "what_can_i_do": "Visit the site before it crashes someday." }, }; + if (window.location.search == '') { + window.history.pushState('sss', '', '?s'); + } function extractUrlParam(str, key) { const urlParams = new URLSearchParams(str) @@ -155,20 +158,19 @@ headers: { 'Accept': 'application/json' }, - }) - .then(response => { + }).then(response => { if (!response.ok) { throw new Error('failed to get preset'); } return response.json(); - }) - .then(result => { + }).then(result => { if (result.status != 'ok') { return } console.log(result.parameters) initialConfig = result.parameters loadConfig(initialConfig); + render() }) } @@ -214,7 +216,7 @@ function readConfig() { return { title: $('title').value, - error_code: Number($('error_code').value) || 0, + error_code: Number($('error_code').value) || 500, more_information: { hidden: !!$('more_hidden').checked, text: $('more_text').value, @@ -329,7 +331,7 @@ }) } function exportJSON() { - let content = JSON.stringify(lastCfg) + let content = JSON.stringify(lastCfg, null, 4) const file = new File([content], 'cloudflare-error-page-params.json', { type: 'text/plain', }) @@ -417,6 +419,7 @@ body { zoom: 90%; } + /* Layout: editor + preview */ .app { display: flex; @@ -734,8 +737,8 @@
- +
@@ -784,7 +787,8 @@
You can also embed the error page into your own website. See - Quickstart in the + Quickstart in the homepage for steps.
@@ -797,7 +801,7 @@
Preview
- +