From 3abcc94eca70e71c46939a390c801dcbef27e24c Mon Sep 17 00:00:00 2001 From: luxick Date: Fri, 24 Jul 2026 15:16:02 +0200 Subject: [PATCH] Improve desktop editing experience --- assets/editor/main.js | 4 ++++ assets/style.css | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/assets/editor/main.js b/assets/editor/main.js index 18ca2e3..5256c67 100644 --- a/assets/editor/main.js +++ b/assets/editor/main.js @@ -51,6 +51,10 @@ var state = CM.EditorState.create({ doc: hidden.value, + // Start with the caret at the end of the existing content — editing an + // existing page almost always means appending, and the default (start + // of doc) buries the caret behind the leading heading. + selection: { anchor: hidden.value.length }, extensions: [ CM.history(), CM.drawSelection(), diff --git a/assets/style.css b/assets/style.css index a21204e..9af2849 100644 --- a/assets/style.css +++ b/assets/style.css @@ -410,6 +410,12 @@ a.heading-anchor:hover { color: var(--primary-hover); } background: var(--bg-panel-hover); overflow-x: auto; scrollbar-width: none; + /* Keep the toolbar in reach on long pages: stick it to the top of the + center column's scroll viewport (just under the header). Mobile overrides + this to a keyboard-hugging bottom bar (see responsive block). */ + position: sticky; + top: 0; + z-index: 30; } .editor-toolbar::-webkit-scrollbar { display: none; } .editor-toolbar > * { flex-shrink: 0; } @@ -432,6 +438,12 @@ body.edit-mode footer { max-width: none; } variables; this only sizes the container. */ .editor-cm { min-height: 60vh; } .editor-cm .cm-editor { height: 100%; } +/* Stretch the editable surface to fill the mount. Without this the + contenteditable is only as tall as the text, so clicking in the empty region + below a short document lands on the (non-editable) scroller and places no + caret. Filling it means a click anywhere maps to the nearest position — the + end of the document. */ +.editor-cm .cm-content { min-height: 60vh; } /* === Search === */ .search-form {