Skip to content

Remember preview scroll position - #34

Open
bkntr wants to merge 1 commit into
Developer-Mike:mainfrom
bkntr:agent/remember-scroll-position
Open

Remember preview scroll position#34
bkntr wants to merge 1 commit into
Developer-Mike:mainfrom
bkntr:agent/remember-scroll-position

Conversation

@bkntr

@bkntr bkntr commented Aug 19, 2026

Copy link
Copy Markdown

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 ci
  • npm run build
  • npx tsc --noEmit
  • git diff upstream/main...HEAD --check

Interactive 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.

@bkntr
bkntr marked this pull request as ready for review August 19, 2026 16:41
@bkntr
bkntr force-pushed the agent/remember-scroll-position branch from acad3b5 to a2000a1 Compare August 19, 2026 16:43
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.

1 participant