Skip to content

Add edit history to viewer state - #1452

Open
dnass wants to merge 5 commits into
page-refactorfrom
viewer-edit-history
Open

dnass wants to merge 5 commits into
page-refactorfrom
viewer-edit-history

Conversation

@dnass

@dnass dnass commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

More groundwork for edit mode. This Introduces a new EditHistory class initialized as viewer.history. History entries are arrays of Pages, and the history stack is seeded from the document's page spec. viewer.pages is derived from the latest entry in the history stack.

The history class includes methods to add a new entry by applying an edit (moving, duplicating, deleting, or rotating one or more pages), remove the latest entry from the stack, and reset the stack. It also exposes a serialized derived field which condenses the current state into the format expected by the modifications API.

@dnass
dnass added this pull request to stack #1453 November 7, 2026 19:11
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

Preview deployed: https://preview-1452.staging.documentcloud.org

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 54.35% 4377 / 8052
🔵 Statements 53.04% 5160 / 9728
🔵 Functions 48.75% 1689 / 3464
🔵 Branches 51.25% 2252 / 4394
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/lib/api/types.d.ts 0% 0% 0% 0%
src/lib/state/edit.svelte.ts 100% 96.29% 100% 100%
src/lib/state/viewer.svelte.ts 98.73% 97.14% 100% 98.48% 30-33
src/lib/utils/normalizeAngle.ts 100% 100% 100% 100%
Generated in workflow #1474 for commit 3608f4e by the Vitest Coverage Report Action

@dnass
dnass force-pushed the viewer-edit-history branch from ba2de97 to f25df39 Compare November 9, 2026 16:07
@dnass
dnass marked this pull request as ready for review November 11, 2026 16:45
Comment thread src/lib/state/edit.svelte.ts Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants