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; }