Skip to content

Fix image centering regression and guard cover-title edits per notebook - #48

Merged
setzor merged 1 commit into
mainfrom
vibe/image-centering-cover-title-3d935b
Oct 27, 2026
Merged

setzor merged 1 commit into
mainfrom
vibe/image-centering-cover-title-3d935b

Conversation

@setzor

@setzor setzor commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Image styling regression (no longer centered) + stale attrs in resize commit #21 (image styling regression + stale resize attrs):
    • Merged the two conflicting .entry-image CSS blocks into one: display: table; margin: 1em auto; — images center again (the resize PR's inline-block defeated the margin: auto alignment rules) while keeping position: relative for the resize handles.
    • The resize commit() now reads attrs from the node currently at the position (doc.nodeAt(pos)) instead of the node view's creation-time node, so an update mid-drag (e.g. undo) no longer re-applies stale attrs.
  • Edge case: editing cover title while switching notebooks can write the wrong notebook's name #18 (cover title can rename the wrong notebook): extracted cover-title editing into src/covertitle.ts (attachCoverTitleEditing), which captures the notebook id on focus, commits against that id on blur, reverts the text on Escape, and refuses to rename when the active notebook changed mid-edit. The cover subtitle got the same focus-time capture guard in main.ts.

Verification

  • pnpm test — 18 files, 85 tests passed, including new tests: image resize merges width with current attrs (editor.test.ts), and cover-title commit/revert/cross-notebook/Escape behavior (covertitle.test.ts).
  • pnpm typecheck and pnpm build pass.

Closes #21
Closes #18

… notebook

- Merge the duplicate .entry-image blocks; display:table with margin
  auto restores centering for aligned/default images while keeping
  resize handles positioned (#21).
- Resize commit() reads attrs from the node currently at the position
  instead of the node captured at node-view creation (#21).
- Cover title editing captures the notebook id at focus, commits against
  that id on blur, reverts on Escape, and refuses cross-notebook
  renames; cover subtitle gets the same focus-time capture (#18).

Co-authored-by: setzor <setzor@users.noreply.github.com>
@setzor
setzor marked this pull request as ready for review October 27, 2026 04:43
@setzor
setzor merged commit bc4a333 into main Oct 27, 2026
2 checks passed
@setzor
setzor deleted the vibe/image-centering-cover-title-3d935b branch October 27, 2026 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants