Skip to content

Conversation

@paula-stacho
Copy link
Collaborator

Description

Fixing the styles for code editor on export schema modal

Before:
The whole editor scrolls, so the actions get hidden down the line.
Screenshot 2025-03-18 at 18 38 23

After:
Only content of the editor scrolls.
Screenshot 2025-03-18 at 18 38 12

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@paula-stacho paula-stacho added the feature flagged PRs labeled with this label will not be included in the release notes of the next release label Mar 18, 2025
@github-actions github-actions bot added the fix label Mar 18, 2025
@paula-stacho paula-stacho requested a review from Anemy March 18, 2025 17:41
});

const codeStyles = css({
'& .cm-editor': {
Copy link
Member

Choose a reason for hiding this comment

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

It does strike me as not the best practice to be overriding the internal styles of the editor here. Ideally compass-schema shouldn't know we're even using code mirror under the hood. Since we're already doing it, I think fine as is, but something we should probably avoid.

Copy link
Member

Choose a reason for hiding this comment

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

I was the one who introduced this too 🤦
Looks like we do it in a few other places in Compass also.

Copy link
Collaborator Author

@paula-stacho paula-stacho Mar 19, 2025

Choose a reason for hiding this comment

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

You're right, we could've just added some parameters that the compass component would translate into these styles. We don't and we even named the component <CodeMirrorMultilineEditor />, so I think the ship has sailed 😅 . And by sailed I mean I don't think we have time to fix that atm 🙈

Copy link
Collaborator

@gribnoysup gribnoysup Mar 19, 2025

Choose a reason for hiding this comment

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

... or you can just set maxLines on the component to 15 (which matches the math here) and it will already make the editor limited in size and the action buttons sticky with no extra styles and class names referring to the component internals 🙂

@paula-stacho paula-stacho merged commit 9fc0be6 into main Mar 19, 2025
80 of 81 checks passed
@paula-stacho paula-stacho deleted the COMPASS-9141 branch March 19, 2025 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature flagged PRs labeled with this label will not be included in the release notes of the next release fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants