fix(editor): left-align chapter writing surface

This commit is contained in:
avi 2026-08-31 12:42:47 -05:00
commit 8e49d2769a
2 changed files with 11 additions and 1 deletions

View file

@ -45,6 +45,16 @@ export function createEditorFeature(ctx: BookCtx): EditorFeature {
onChange: () => handleEditorChange(), onChange: () => handleEditorChange(),
onSelectionUpdate: () => handleSelection(), 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 // Debounce for automatic saves while typing. When the user stops typing for
// this long the chapter is persisted in the background so navigating away // this long the chapter is persisted in the background so navigating away

View file

@ -1665,7 +1665,7 @@ body.focus-mode .editor {
background: var(--color-bg); background: var(--color-bg);
padding: 24px 20px; padding: 24px 20px;
max-width: 820px; max-width: 820px;
margin: 0 auto; margin: 0;
outline: none; outline: none;
} }