Skip to content

Conversation

@alcarney
Copy link
Member

@alcarney alcarney commented Sep 29, 2024

For some reason, the object representation of the same URI is not stable
leading to synchronised scrolling breaking after scrolling the preview
window.

Instead, compare the string representation of the uris which should
work around the differences that should not matter.
As part of its initial setup, the injected `webview.js` script now
rewrites any `a.internal` links to include the port number of the
current websocket connection. This ensures that as the user navigates
by clicking on links on the page the websocket connection to the
language server is preserved.

Also by doing an initial scroll sync on page load, this ensures that
the editor is kept in sync with the change! There is a chance for this
to be a bit flaky as this in direct conflict with the initial sync an
editor might want to make if it initiates the preview of a page.

By introducing a small delay on the sync made by the webview, we are
relying on the editor winning the race and getting its message in
first... I'm sure that will never cause an issue in the future!
@alcarney alcarney merged commit 7f16384 into swyddfa:develop Sep 29, 2024
12 checks passed
@alcarney alcarney deleted the fix-sync-scroll branch September 29, 2024 22:13
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.

Scrolling editor no longer syncs with previewer after preview scroll Navigating in the preview should navigate in the editor.

1 participant