From 8e49d2769a6272d05a0b9582783120e1fddfa47d Mon Sep 17 00:00:00 2001 From: avi Date: Mon, 31 Aug 2026 12:42:47 -0500 Subject: [PATCH] fix(editor): left-align chapter writing surface --- src/renderer/book/editor.ts | 10 ++++++++++ src/renderer/index.css | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/renderer/book/editor.ts b/src/renderer/book/editor.ts index baacf57..bb230c0 100644 --- a/src/renderer/book/editor.ts +++ b/src/renderer/book/editor.ts @@ -45,6 +45,16 @@ export function createEditorFeature(ctx: BookCtx): EditorFeature { onChange: () => handleEditorChange(), onSelectionUpdate: () => handleSelection(), }); + const editorHost = $("editorHost"); + + // The ProseMirror surface is narrower than its host for readable line + // lengths. Keep the surrounding editor area clickable so a new chapter can + // be focused without requiring a click on the centered content column. + editorHost.addEventListener("mousedown", (event) => { + if (event.target !== editorHost) return; + event.preventDefault(); + editor.commands.focus("end"); + }); // Debounce for automatic saves while typing. When the user stops typing for // this long the chapter is persisted in the background so navigating away diff --git a/src/renderer/index.css b/src/renderer/index.css index feb6830..890defe 100644 --- a/src/renderer/index.css +++ b/src/renderer/index.css @@ -1665,7 +1665,7 @@ body.focus-mode .editor { background: var(--color-bg); padding: 24px 20px; max-width: 820px; - margin: 0 auto; + margin: 0; outline: none; }