Feature/multi label pagination#1
Conversation
…support
Replace the single top-level objects array with pages[] + currentPageIndex.
Object mutations now operate on pages[currentPageIndex]; consumers read via
the new useCurrentObjects() / currentObjects() selectors.
Adds page-management actions (addPage, removePage, duplicatePage,
setCurrentPage). Persisted state migrates legacy { objects } shape into
{ pages: [{ objects }], currentPageIndex: 0 } via persist version bump.
UI is unchanged (single page, no pagination control yet); follow-up commits
add the navigation UI, multi-page ZPL export/import, and JSON format update.
Adds a small bottom-center widget to the canvas with page indicator, prev/next, add-page, and remove-page controls. Page Up / Page Down navigate between pages. README keyboard shortcuts table updated. The single ZPL output still concatenates only the current page's objects; multi-page export comes in the next commit.
Adds generateMultiPageZPL() which emits one ^XA...^XZ block per page. Download and the live ZPL output panel now include every page; the Labelary preview and Print path stay single-page (current page only) since Labelary renders one image at a time.
Splits incoming ZPL on ^XA boundaries and parses each block as its own
page. The first block's dimensions become the document's; differing
dimensions in later blocks are flagged in the import report.
importZplText now returns { labelConfig, pages, report, notice }
instead of a flat objects array. Adds tests covering single, multi,
mixed-dimension, and malformed input.
The canonical .json shape becomes { label, pages: [{ objects }, ...] }.
parseDesignFile auto-migrates legacy { label, objects } files into a
single-page document so older saves keep loading.
Replaces the multi-label limitation with a dedicated Pages section in the usage flow and notes that the Labelary preview shows only the current page even though the export contains every page.
The bottom-center page widget now appears only with 2+ pages so the default single-label canvas stays uncluttered. Adding a page is moved to a new File menu entry so the feature stays discoverable. README updated to match the new entry point.
There was a problem hiding this comment.
Code Review
This pull request introduces multi-page support for ZPL labels, refactoring the state to manage a collection of pages and adding a pagination control for navigation. It updates ZPL generation, import services, and file serialization to support multiple labels while providing a migration path for legacy single-page designs. Feedback identifies that the ZPL block splitting logic should be improved to handle case-insensitivity and the ~XA prefix to ensure reliable parsing of imported ZPL code.
ZPL commands are case-insensitive per spec; the existing splitter matched only uppercase ^XA, so lowercase or mixed-case input fell through and produced no pages. Switches to a regex split with capture group so the original delimiter is preserved when re-attached.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces multi-page support to the ZPL designer, refactoring the state to manage an array of pages and updating the canvas, import/export services, and design file persistence to handle multiple labels. A new pagination control component and keyboard shortcuts for page navigation were also implemented. Feedback indicates that document-wide actions in the application shell should evaluate content across all pages to avoid being incorrectly disabled when the current page is empty, and highlights several hardcoded strings that should be moved to localization files for better internationalization support.
Address two PR review findings: 1. hasObjects was computed from the current page's objects only, so Export ZPL / Save Design / Send to Zebra were incorrectly disabled when the current page was empty even if other pages had content. Switched to checking pages.some(p => p.objects.length > 0). 2. The "Add page" menu entry was hardcoded English. Added the t.app.addPage translation key across all 32 locales.
No description provided.