From 60b514eae73c22a55b782f79cc07932ba86008ff Mon Sep 17 00:00:00 2001 From: luxick Date: Thu, 23 Apr 2026 14:34:07 +0200 Subject: [PATCH] Prefill Empty pages --- assets/editor.js | 5 ++++- main.go | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/assets/editor.js b/assets/editor.js index 93e4a32..0277ba4 100644 --- a/assets/editor.js +++ b/assets/editor.js @@ -123,7 +123,10 @@ document.addEventListener('keydown', function (e) { if (!e.altKey || !e.shiftKey) return; - var action = keyMap[e.key]; + // Shift+digit produces a layout-dependent character in e.key (e.g. "!" + // on US, "!" on DE), so fall back to e.code for digit rows. + var key = /^Digit[0-9]$/.test(e.code) ? e.code.slice(5) : e.key; + var action = keyMap[key]; if (action) { e.preventDefault(); action(); diff --git a/main.go b/main.go index c9beca1..1d408bf 100644 --- a/main.go +++ b/main.go @@ -187,6 +187,8 @@ func (h *handler) serveDir(w http.ResponseWriter, r *http.Request, urlPath, fsPa if sectionIndex < len(sections) { rawContent = string(sections[sectionIndex]) } + } else if editMode && rawContent == "" && urlPath != "/" { + rawContent = "# " + pageTitle(urlPath) + "\n\n" } data := pageData{