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

Use ResizeObserver for monaco editor automaticLayout #93630

Merged
merged 2 commits into from
Mar 29, 2020
Merged

Use ResizeObserver for monaco editor automaticLayout #93630

merged 2 commits into from
Mar 29, 2020

Conversation

nrayburn-tech
Copy link
Contributor

@nrayburn-tech nrayburn-tech commented Mar 28, 2020

Replaces the MutationObserver with ResizeObserver. Uses a timeout for any browser that does not support ResizeObserver. (Safari is the only one of the currently supported browsers without ResizeObserver.)
When resizing an editor with a dynamic size (i.e. a percentage for the width), the editor should resize automatically.

This PR fixes #1855, fixes #1878 in monaco-editor.
Might fix #1884 as well.

This PR replaces #90111.

@nrayburn-tech
Copy link
Contributor Author

I am not sure if the types for ResizeObserver belong at the top of the file, they are temporary because they are not currently in typescript, ts issue.

The setInterval() function defaults to a type of NodeJS.Timeout, so it is being cast to unknown and then number. I don't know if this is really the correct way to handle this.

I dropped the private _onDidMutate method to use the public observe method instead since they were both doing the same thing. I didn't think both methods needed to be kept.

@alexdima let me know if anything needs to be changed, I just wanted to mention a few concerns before marking it as "Ready for review".

@alexdima
Copy link
Member

This is great, thank you!

@alexdima alexdima marked this pull request as ready for review March 29, 2020 17:55
@alexdima alexdima added this to the March 2020 milestone Mar 29, 2020
@alexdima alexdima merged commit 35cbc3f into microsoft:master Mar 29, 2020
stefan-lacatus added a commit to thingworx-field-work/MonacoEditorTWX that referenced this pull request Apr 1, 2020
This temporary fix resolves a regression caused by updating monaco to 0.20.0
Will be fixed properly once microsoft/vscode#93630 is released
@github-actions github-actions bot locked and limited conversation to collaborators May 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants