From 38f28fb3973466a9bde13aea190bfa83eba89811 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Tue, 2 Jun 2026 15:00:17 -0400 Subject: [PATCH] book: layers panel scopes to the active book page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The layers sidebar fell through to the case-cover sections (Back / Spine / Front) when in book mode because templateLayerTargetsForMode() had no book branch. It now returns a single panel labeled "Page N" keyed to the active entry's target (`book-page:`), so the layers listed and the Add-layer actions are scoped to the page the user is editing. When no page is open (Pages overview is showing) the helper returns an empty list and renderLayerList() naturally renders nothing — consistent with the deck-sorter view that also hides the layers fieldset until a slide is open. --- src/index.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/index.html b/src/index.html index a66a918..0fdfce6 100644 --- a/src/index.html +++ b/src/index.html @@ -8727,6 +8727,18 @@ if (isCanvasMode(state.templateMode)) return [ { key: 'canvas', label: 'Canvas' } ]; + if (state.templateMode === 'book') { + // Book mode: the layers panel scopes to whichever page is + // open in the per-page editor. No page open → no panels + // (Pages overview shows tiles, not layer rows). + const editId = state.book?.editingEntryId; + if (editId) { + const idx = (state.book?.pages || []).findIndex(p => p.id === editId); + const human = idx >= 0 ? `Page ${idx + 1}` : 'Current page'; + return [{ key: `book-page:${editId}`, label: human }]; + } + return []; + } // Cover mode. In combined-wrap mode the artwork is one open canvas, so // back/spine/front sub-regions aren't meaningful — collapse to a single // "Cover trim area" panel that still lists any pre-existing back/spine/