Skip to content

Sync editor and preview scrolling, with optional snap on click - #469

Open
Damox101za wants to merge 1 commit into
petertzy:mainfrom
Damox101za:feature/sync-scroll
Open

Damox101za wants to merge 1 commit into
petertzy:mainfrom
Damox101za:feature/sync-scroll

Conversation

@Damox101za

Copy link
Copy Markdown

Scrolling the editor or the preview now moves the other to the same relative position, and the preview keeps its place when it re-renders after an edit. Clicking a line in the editor glides the preview to the matching block and briefly highlights it; this can be turned off from View > Snap Preview on Click and the choice is remembered.

The preview iframe stays sandboxed: the two sides talk through postMessage via a small injected script, and the preview only accepts messages from the editor window. The logic lives in lib/preview-sync.mjs with Node tests.

Scrolling the editor or the preview now moves the other to the same
relative position, and the preview keeps its place when it re-renders
after an edit. Clicking a line in the editor glides the preview to the
matching block and briefly highlights it; this can be turned off from
View > Snap Preview on Click and the choice is remembered.

The preview iframe stays sandboxed: the two sides talk through
postMessage via a small injected script, and the preview only accepts
messages from the editor window. The logic lives in
lib/preview-sync.mjs with Node tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@petertzy
petertzy requested a review from praghnyau November 6, 2026 13:11

This branch has not been deployed

No deployments
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