Feature/v2/page editor selection persistance (#4306)

Fixed page editor selection persistance
Fixed delete sleected
Fixed display issue on some tools on reset settings call

---------

Co-authored-by: Anthony Stirling <[email protected]>
This commit is contained in:
Reece Browne
2025-08-26 17:26:30 +01:00
committed by GitHub
co-authored by Anthony Stirling
parent 47ccb6a6ed
commit 68d59fd377
13 changed files with 192 additions and 171 deletions
@@ -403,8 +403,7 @@ export class PageBreakCommand extends DOMCommand {
constructor(
private selectedPageNumbers: number[],
private getCurrentDocument: () => PDFDocument | null,
private setDocument: (doc: PDFDocument) => void,
private setSelectedPages: (pages: number[]) => void
private setDocument: (doc: PDFDocument) => void
) {
super();
}
@@ -455,19 +454,7 @@ export class PageBreakCommand extends DOMCommand {
this.setDocument(updatedDocument);
// Maintain existing selection by mapping original selected pages to their new positions
const updatedSelection: number[] = [];
this.selectedPageNumbers.forEach(originalPageNum => {
// Find the original page by matching the page ID from the original document
const originalPage = this.originalDocument?.pages[originalPageNum - 1];
if (originalPage) {
const foundPage = newPages.find(page => page.id === originalPage.id && !page.isBlankPage);
if (foundPage) {
updatedSelection.push(foundPage.pageNumber);
}
}
});
this.setSelectedPages(updatedSelection);
// No need to maintain selection - page IDs remain stable, so selection persists automatically
}
undo(): void {