-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Feature Request] Use resizeObserver for editor layout. #1266
Comments
We can probably user MutationObserver for IE and ResizeObserver for browsers support that. |
Instead of using
This works for both growing and shrinking the page. Monaco quickly resizes to the correct size. |
@dcecile This is not related to your use case. That lib uses resize-observer-polyfill which uses mutation observer. We don't need to fake or polyfill. And this request asks for an implementation change. |
@alexdima I think that I can implement something for this, but wanted to run my ideas by somebody before working on it. Modify the ElementSizeObserver to create a MutationObserver on the editor element. When the observer is triggered, we will update the editor size. It is my understanding that MutationObserver only catches changes to the DOM, so we would need to bind another listener to the window resize event. As mentioned above, a ResizeObserver can be used instead for the browsers that support it. Does that sound correct? If so, I can work on creating a PR for it. |
@nrayburn-tech 👍 PR welcome |
@alexdima Should this also be used in the diffEditorWidget? |
@nrayburn-tech Good point. I have pushed microsoft/vscode@88146d9 for this. |
The way of checking element width every 100ms is not ideal. Use resizeObserver instead.
https://developers.google.com/web/updates/2016/10/resizeobserver
The text was updated successfully, but these errors were encountered: