Remember preview scroll position - #34
Open
bkntr wants to merge 1 commit into
Open
Conversation
bkntr
marked this pull request as ready for review
August 19, 2026 16:41
bkntr
force-pushed
the
agent/remember-scroll-position
branch
from
August 19, 2026 16:43
acad3b5 to
a2000a1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Docxer discarded the preview scroll position because it rebuilt the preview DOM whenever a file loaded without participating in Obsidian's ephemeral view-state lifecycle or storing a durable per-file position.
This change captures the preview container's scroll offset in ephemeral state for Back/Forward navigation and in plugin data for reopening a tab or restarting Obsidian. Restored values are validated, restoration remains queued until the asynchronously rendered preview is attached, and durable positions are debounced while scrolling and flushed when the view unloads.
User impact
Returning to a DOCX preview now restores the previous reading location across navigation, tab closure, and Obsidian restarts.
Validation
npm cinpm run buildnpx tsc --noEmitgit diff upstream/main...HEAD --checkInteractive Obsidian validation confirmed restoration through Back navigation, tab close/reopen, and a full Obsidian restart. The runtime checks restored the exact captured offsets in all three cases.