The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
fix(studio): a saved layout's background unlinks the page from its theme colour
Maurice105002984294
diff --git a/shared/src/book/book-layouts.spec.ts b/shared/src/book/book-layouts.spec.tsindex a59f2e3f5..4fa2ad948 100644--- a/shared/src/book/book-layouts.spec.ts+++ b/shared/src/book/book-layouts.spec.ts@@ -264,6 +264,23 @@ describe('a mark set as text on a page laid out again', () => {});});+describe('the page background a saved layout brings', () => {+ it("BOOKLAY-030: replaces the page's colour and its link to a theme colour, so a theme cannot paint over it", () => {+ const from = bookSpreadSchema.parse({ id: 'a', role: 'inner', background: '#123456', elements: [] });+ const layout = bookLayoutFromSpread(from, page, 'Navy');+ const linked = bookSpreadSchema.parse({+ id: 'b',+ role: 'inner',+ background: '#ffffff',+ backgroundToken: 'paper',+ elements: [],+ });+ const next = applySavedBookLayout(linked, layout, page);+ expect(next.background).toBe('#123456');+ expect(next).not.toHaveProperty('backgroundToken');+ });+});+describe('letters filled with a photo in a saved layout', () => {const frame = { x: 10, y: 10, w: 80, h: 40 };const filledWith = (photoId: number) => ({ type: 'photo' as const, photoId, focalX: 0.5, focalY: 0.5, zoom: 1 });diff --git a/shared/src/book/book-saved-layouts.ts b/shared/src/book/book-saved-layouts.tsindex 3ce3b804a..5a734d29b 100644--- a/shared/src/book/book-saved-layouts.ts+++ b/shared/src/book/book-saved-layouts.ts@@ -145,7 +145,9 @@ export function applySavedBookLayout(spread: BookSpread, layout: BookLayout, pagconst used = new Set(wordsFor.values());const parked = [...photos.slice(pi), ...texts.filter((t) => !used.has(t))].slice(0, MAX_SPREAD_ELEMENTS);- const { backgroundPaint: _old, ...rest } = spread;+ // The layout's background replaces the page's, so the page's link to a theme+ // colour goes with it: kept, the next theme would paint over the layout's colour.+ const { backgroundPaint: _old, backgroundToken: _unlinked, ...rest } = spread;const backgroundPaint = layout.backgroundPaint ? { backgroundPaint: layout.backgroundPaint } : {};return { ...rest, background: layout.background, ...backgroundPaint, elements: out, parked };}