Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preview Improvements #906

Merged
merged 3 commits into from
Sep 29, 2024
Merged

Preview Improvements #906

merged 3 commits into from
Sep 29, 2024

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
13 of 14 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
1 participant