-
Notifications
You must be signed in to change notification settings - Fork 37.4k
Fix scrolling of markdown preview. Close #65504 #111094
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
Conversation
|
With the approach of this PR, we have to make
Otherwise, Another approach is setting vscode/extensions/markdown-language-features/preview-src/index.ts Lines 59 to 68 in 5a5afac
|
mjbvz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking a look. Just a quick question with the implementation. Once that looks good, we can test this out in insiders
| return Promise.resolve(); | ||
| } else { | ||
| return new Promise<void>((resolve) => { | ||
| e.addEventListener('load', () => resolve()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of checking all images, should this use the window.load event? That should only be fired when all resources are loaded
If we continue checking for each image, should there also be a check for the error event in case the image fails to load?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using window.addEventListener('load', cb); does not work. When webview.html = content executed on the extension host, the load event does not occur on the webview.
I have edited the PR to treat cases when the error event occurs.
|
I'm a supreme newbie trying to learn Unity when this problem started happening for no apparent reason in Visual Studio Code. Could you explain the instructions: "Ensure that window.scrollTo is called after images loaded." ? ohgodohno.mp4 |
|
Thanks! This will be in the next insiders build. Let's see if it causes any problems in insiders. If everything looks good, it will go out with Jan VS Code stable release |
Fix scrolling of markdown preview. This PR fixes #65504.
window.scrollTois called after images loaded.window.scrollTocalled fromonceDocumentLoadedandonUpdateViewdoes not lead tomessaging.postMessage('revealLine', { line }).I think that it is not guaranteed that
scrollDisabled = trueandscrollDisabled = falseare alternately executed in order when users type very quickly. So, we have to use the counterscrollDisabledCountinstead of the booleanscrollDisabled.I have tested this PR with the document https://github.com/jlelong/LaTeX-Workshop-wiki/blob/master/Hover.md.
Before:
After:
