New pages inherit the size of the page they are created from

Blank pages added next to an existing page (via the "+" tile, Alt+Arrow
or the page menu) now copy that page's width and height, including
imported PDF pages, instead of always falling back to A4. The "+" preview
tile uses the same size so it matches the page it will create.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VsorPV3JeJRoZ1mD1pdvtL
This commit is contained in:
besbara 2026-09-26 19:55:24 +00:00
parent 0ad405c26e
commit fa2f491161
2 changed files with 4 additions and 4 deletions

View file

@ -161,8 +161,8 @@ export class CanvasDoc {
addBlankPage(anchor: string, dir: Dir): string | null {
const a = this.pages[anchor];
// New pages default to A4, oriented like their neighbour when it's a plain page.
const size = a && !a.origin && a.width > a.height ? { width: A4.height, height: A4.width } : A4;
// New pages inherit the size of the page they grow from (A4 if it's missing).
const size = a ? { width: a.width, height: a.height } : A4;
const id = newId();
return this.insertPages(anchor, dir, [{ id, ...size, markdown: '', strokes: [] }]) ? id : null;
}