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

Fix: Resolve layout shrink issue of Monaco editor on handbook toggle #3164

Merged
merged 1 commit into from
Jun 24, 2024

Conversation

SaeWooKKang
Copy link
Contributor

@SaeWooKKang SaeWooKKang commented Jun 21, 2024

It seemed like a simple problem, so I didn't make the issue first. Please let me know if you have any problems. Thank you always.

What this PR solves

  • Resolve layout shrink issue of Monaco editor on handbook toggle

Summary

  • When I click the help button, the 'showCode' function is called, and inside sandbox.editor.layout() failed to calculate the layout normally. So I solved it by putting width, height in the parameter
  • I thought it would be okay to calculate it as 210px, which is the area of the 'navigation-container(class name)' area, but there was a slight error. So I applied it as 200px. Is there a better way to calculate it?
스크린샷 2024-06-21 오후 8 04 36

Steps to Reproduce

  1. Go to typescript playground
  2. Toggle the 'help' button in the sub-navigation area.
2024-06-21.7.26.43.mov

Modified screen

2024-06-21.7.41.36.mov

@orta
Copy link
Contributor

orta commented Jun 23, 2024

The random 200 feels pretty arbitrary, what happens if you add a setTimeout with 100ms and then trigger the relayout instead?

@SaeWooKKang
Copy link
Contributor Author

SaeWooKKang commented Jun 24, 2024

@orta Thank you for your better suggestion. As you said, it seems to have been a matter of the order of execution.

So instead of running setTimeout, I changed the order in which showCodes are executed in the sideNavForHandbook function to the bottom.

AS-IS

The existing code area was occupied except for the handbook area.

스크린샷 2024-06-24 오전 11 32 09 스크린샷 2024-06-24 오전 11 32 14

TO-BE

After the handbook area was removed from dom, the layout was changed to be calculated.

스크린샷 2024-06-24 오전 11 32 51 스크린샷 2024-06-24 오전 11 32 48 스크린샷 2024-06-24 오전 11 32 45

@jakebailey jakebailey added the deploy-preview Enables automatic deployments to preview environments on a PR label Jun 24, 2024
Copy link
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://victorious-plant-05c166c10-3164.centralus.5.azurestaticapps.net

@orta
Copy link
Contributor

orta commented Jun 24, 2024

Great, yeah that feels good 👍🏻

Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jakebailey jakebailey merged commit 26343c8 into microsoft:v2 Jun 24, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy-preview Enables automatic deployments to preview environments on a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants