Download Latest Version openpublisher5g_amd64-windows.exe (81.1 MB)
Home / 5.7.9
Name Modified Size InfoDownloads / Week
Parent folder
5.7.9_ Multi-Page to Single-Page View Return Auto-Focus, True Visual Centering _ Zoom Level Preservation source code.tar.gz 2026-10-12 22.5 MB
5.7.9_ Multi-Page to Single-Page View Return Auto-Focus, True Visual Centering _ Zoom Level Preservation source code.zip 2026-10-12 22.8 MB
README.md 2026-10-12 10.5 kB
OpenPublisher-5-x86_64.AppImage 2026-10-12 166.4 MB
openpublisher5_amd64-windows-portable.exe 2026-10-12 183.2 MB
openpublisher5_amd64-windows.exe 2026-10-12 165.2 MB
openpublisher5_amd64-macos.dmg 2026-10-12 233.1 MB
openpublisher5_amd64-linux.run 2026-10-12 193.4 MB
openpublisher5_amd64-linux.rpm 2026-10-12 215.4 MB
openpublisher5_amd64-linux.flatpak 2026-10-12 153.6 MB
openpublisher5_amd64-linux.deb 2026-10-12 156.2 MB
openpublisher5_amd64-freebsd.pkg 2026-10-12 185.5 MB
Totals: 12 Items   1.7 GB 0

πŸš€ Summary

Version 5.7.9 resolves a viewport navigation and positioning defect occurring when returning from Multi-Page Overview to Single-Page editing mode inside the desktop client and standard browsers, while preserving user zoom levels and unifying document focus across all return pathways:

  1. Multi-Page Overview to Single-Page Return Auto-Focus: Fixed an issue where switching from Multi-Page Overview back to Single-Page view left the viewport stranded at the top-left pasteboard origin (scrollLeft = 0, scrollTop = 0). In NW.js desktop client environments with wide pasteboard margins (marginLeft: 765px+), users were left looking at empty pasteboard and had to manually scroll right and down (or scroll until the floating return button appeared) to locate their document. Returning to single-page view now automatically centers and focuses directly on the active document with 0px offset.
  2. Universal Return Pathway Centering: Unifies all exit paths from multi-page view (setViewMode('single'), ribbon "Single" button, status bar "Single" button, double-clicking a thumbnail slot, pressing Enter on a slot, pressing Esc, or calling focusPage()) through an automated centering pipeline inside exitMultiPageView().
  3. True Visual Document Centering: Centering calculations dynamically determine the true visual center of #paper (paper.offsetLeft + paper.offsetWidth / 2), taking into account NW.js host wrapper margins (marginLeft: 765px+), flexbox layouts, and custom pan offsets, ensuring the page lands symmetrically in the center of the viewport across all environments.
  4. Instant View Mode Transition: Enhanced returnToPage(instant) to support immediate zero-delay repositioning (behavior: 'auto') on view mode transitions, eliminating disorienting 500ms glide animations across empty pasteboard space.
  5. Zoom Level Preservation Across View Modes: When entering multi-page overview, the editor now preserves the user's prior single-page editing zoom (_preMultiPageZoom) and restores it upon exiting multi-page view, automatically synchronizing both the ribbon zoom slider and percentage indicator.
  6. Double-Shot Margin Reflow Synchronization: Scheduled secondary micro-syncs at 30ms and 100ms in exitMultiPageView() to ensure that asynchronous NW.js host wrapper margin recalculations and MutationObserver reflows remain centered with 0px offset.
  7. Page Switch Execution Ordering: In openPageInSingleMode(index), fixed the execution order to ensure switchPage(index) runs before view mode switching, guaranteeing that target page content serializes and renders cleanly.
  8. Defensive Dialog Overlay Initialization: Added lazy overlay initialization to DialogSystem.show() in ui/ui.js so that opening dialogs or modals prior to explicit DOM setup never throws null overlay reference exceptions.
  9. Adaptive Fit-to-Page & Fit-to-Width Calculations: Updated fitToPage() and fitToWidth() in canvas/canvas.js to compute horizontal centering based on paperVisualCenter whenever custom pasteboard margins are active.
  10. Full Subsystem & Cache Synchronization: Synchronized all 83 asset cachebusters to ?v=5.7.9 in index.html, bumped Service Worker cache namespace to open-publisher-v5-7-9, and updated all subsystem headers, logs, and about dialogs.

πŸ” Root Cause Analysis & Technical Implementation

1. The Multi-Page to Single-Page View Return Defect

  • Failure Mode in NW.js: Inside the NW.js desktop client (wrapper.html), the host injects wide margins into #paper (paper.style.marginLeft = marginH + 'px', typically 765px to 1282px) with viewport.style.justifyContent = 'flex-start'. When the user enters multi-page overview (setViewMode('multipage')), #paper is hidden, #multi-page-wrapper is created, and zoom is set to ~0.35. When exiting back to single-page view, exitMultiPageView() previously made #paper visible and removed the multi-page wrapper, but never touched viewport.scrollLeft or viewport.scrollTop.
  • As a consequence, viewport.scrollLeft remained at 0 and viewport.scrollTop at 0 (the far top-left corner of the pasteboard), while #paper sat at marginLeft = 765px+, forcing the user to manually scroll right and down or hunt for the document.
  • The Solution:
  • Integrated returnToPage(true) directly into exitMultiPageView() right after unhiding #paper and re-rendering the active page.
  • In returnToPage(instant = false), implemented an instant flag that uses scrollBehavior = instant ? 'auto' : 'smooth'. For view switches, instant scrolling immediately places the viewport over the page without any visual gliding delay.
  • Calculated exact horizontal center: targetScrollLeft = Math.max(0, Math.min(vp.scrollWidth - vpW, Math.round(paperVisualCenter - (vpW / 2)))) where paperVisualCenter = paper.offsetLeft + (paper.offsetWidth / 2).
  • Calculated exact vertical top: targetScrollTop = paperVisualTop <= 60 ? 0 : Math.max(0, Math.min(vp.scrollHeight - vpH, Math.round(paperVisualTop - 50))), placing the document cleanly at the 50px top padding origin aligned with the vertical ruler.

2. Zoom Level Overwrite & Restoration

  • Failure Mode: When entering multi-page overview, enterMultiPageView() overwrote state.zoom with overview zoom (~0.35). Upon returning to single-page view, exitMultiPageView() previously applied scale(${state.zoom}), leaving the document stranded at overview zoom (35%) rather than the user's prior editing magnification (e.g. 100% or 60%).
  • The Solution:
  • In enterMultiPageView(), stored the active zoom in window._preMultiPageZoom before applying overview zoom.
  • In exitMultiPageView(), restored state.zoom = window._preMultiPageZoom (defaulting to 1.0 or existing zoom if valid), cleaned up _preMultiPageZoom, updated #zoom-slider with an input event dispatch, and updated #zoom-level-display.

3. Asynchronous NW.js Host Wrapper Reflow Absorption

  • Reflow Timing: In NW.js, host scripts or MutationObservers may compute updated margins on the subsequent animation frame or event loop tick after DOM changes.
  • The Solution: Scheduled secondary micro-syncs at 30ms and 100ms in exitMultiPageView(): javascript setTimeout(() => { if (state && state.viewMode === 'single') window.returnToPage(true); }, 30); setTimeout(() => { if (state && state.viewMode === 'single') window.returnToPage(true); }, 100); This guarantees that once host margins reflow, the viewport rests at exactly 0px horizontal offset.

4. Page Switch Execution Ordering

  • Failure Mode: In window.openPageInSingleMode(index), the function previously assigned state.currentPageIndex = index before calling switchPage(index). Inside switchPage(newIndex), the guard if (newIndex === state.currentPageIndex) return; aborted page switching early, preventing renderPage() and sidebar updates from executing for the new page.
  • The Solution: Updated openPageInSingleMode to invoke switchPage(index) directly when state.currentPageIndex !== index, ensuring the previous page serializes and the new page renders into the canvas prior to switching view mode.

5. Defensive DialogSystem Overlay Initialization

  • Failure Mode: Calling DialogSystem.show() before DialogSystem.init() had attached #custom-dialog-overlay to document.body caused an unhandled TypeError: overlay is null in browser environments like Firefox.
  • The Solution: Added lazy initialization inside DialogSystem.show(): javascript let overlay = document.getElementById('custom-dialog-overlay'); if (!overlay) { this.init(); overlay = document.getElementById('custom-dialog-overlay'); } if (!overlay) return;

πŸ“ Files Modified in 5.7.9

File Changes
canvas/canvas.js Updated exitMultiPageView() to restore pre-overview zoom, unhide paper, re-render active page, and trigger immediate zero-delay visual centering via returnToPage(true) with secondary micro-syncs. Added instant parameter to returnToPage(). Saved _preMultiPageZoom in enterMultiPageView(). Fixed page switch ordering in openPageInSingleMode(). Updated fitToPage(), fitToWidth(), and focusPage() to align with paperVisualCenter.
ui/ui.js Added lazy overlay initialization to DialogSystem.show() to prevent null overlay references if triggered prior to explicit initialization.
index.html Synchronized all 83 asset cachebusters to ?v=5.7.9.
sw.js Bumped Service Worker cache namespace to open-publisher-v5-7-9 and header comment to (v5.7.9).
style.css Bumped header comments to (v5.7.9).
extensions/ui-interactions.js Bumped About dialog subtitle to v5.7.9.
extensions/pwa-install.js Bumped header to (v5.7.9) and Service Worker registration query to sw.js?v=5.7.9.
ui/dashboard.js Updated template fetch cachebuster queries to ?v=5.7.9.
extensions/legacy-fixes.js Bumped engine log to v5.7.9.
extensions/print-engine.js Bumped print sequence log string to v5.7.9.
ui/modals/options-modal.js Bumped header comment to (v5.7.9).
ui/sidebar-context.js Bumped header comment to (v5.7.9).
tools/proofing/spellcheck-engine.js Bumped header comment to (v5.7.9).

βœ… v5.7.9 Automated Test Verification

Test Suite Environment Scenario Result
Suite 1 NW.js Guest Simulation Switched from multi-page overview to single-page view via setViewMode('single') (ribbon / status bar / Esc key) PASSED (centerOffset: 0px, scrollTop: 0px, zoom: 0.6 restored, button hidden)
Suite 2 NW.js Guest Simulation Double-clicked slot 2 / called openPageInSingleMode(1) to switch to page 2 PASSED (centerOffset: 0px, scrollTop: 0px, currentPage: 1, button hidden)
Suite 3 NW.js Guest Simulation Called focusPage(2) from multi-page overview to focus page 3 PASSED (centerOffset: 0px, scrollTop: 0px, currentPage: 2, button hidden)
Cross-Browser Parity Chromium & Firefox Executed all 3 suites across both browser engines 100% PASSED in both Chromium and Firefox

πŸŽ‰ Version 5.7.9 - Open Publisher

Source: README.md, updated 2026-10-12