-
Notifications
You must be signed in to change notification settings - Fork 11
[CC Projects] Lines are sometimes off by one line #1264
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
[CC Projects] Lines are sometimes off by one line #1264
Conversation
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.
Pull Request Overview
This PR fixes line number alignment issues in code blocks throughout the editor by standardizing font usage and applying consistent typography styles. The changes address problems where emojis and other content would cause line highlighting to misalign, and removes an unwanted border from code output blocks.
Key changes:
- Centralized font family definitions in a new
_fonts.scssfile with CSS custom properties for consistent font application - Applied design system typography mixins to ensure consistent line spacing across code blocks and instruction panels
- Removed border styling from code output blocks in the instructions panel
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/assets/stylesheets/settings/_fonts.scss | New file defining standardized sans-serif and monospace font stacks |
| src/assets/stylesheets/index.scss | Migrated to use centralized font variables via CSS custom properties |
| src/assets/stylesheets/InternalStyles.scss | Added font variable definitions with fallbacks for web component customization |
| src/assets/stylesheets/Instructions.scss | Applied typography mixins for consistent line spacing and removed border from code output |
| src/assets/stylesheets/EditorPanel.scss | Applied typography mixin to code editor scroller for consistent line height |
| src/assets/stylesheets/Button.scss | Updated to use centralized sans-serif font variable |
| src/assets/stylesheets/AstroPiModel.scss | Updated to use centralized monospace font variable |
| src/assets/stylesheets/App.scss | Updated to use centralized sans-serif font variable |
| CHANGELOG.md | Documented new features and fixed issues |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,2 @@ | |||
| $font-family-sans-serif: Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; | |||
| $font-family-monospace: RobotoMono, source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace; | |||
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.
My only concern with this is that it might change the fonts we're using in places like within codemirror, as we were using different monospace fonts in different places - maybe that's okay though?
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.
This does indeed change the fonts within codemirror and other places to a standard set. I'm not sure we necessarily need all these fonts to fall back through. It does mean we have a consistent treatment of fonts through the interface now. They can also be customised by the new CSS variables so that in individual applications (e.g. code club projects) a different font could be used.
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.
I'll try and sort out some screenshots of the codemirror change in the projects site UI
loiswells97
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.
Just a few thoughts/questions
|
Awaiting @rammodhvadia or @patch0 to review the changes suggested by Lois. |
loiswells97
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.
Looks good ✅
### Added - Font-family variables that can be used to customise the sans-serif and monospace fonts used in the editor (#1264) - Material symbols font to web component preview page since the Design System depends on this (#1261) - Ability for plugins to add buttons to the SidebarPanel header (#1270, #1271, #1274) - Prevent access to the session from within the editor (#1275) ### Changed - Changed the horizontal scrollbar to show without needing to scroll to the bottom of the editor window (#1257) - Updated Design System react to v2.6.2 (#1261) - Changed SidebarPanel to accept an array of buttons (#1270) - Changed SidebarPanel to use an array of buttons as elements (#1271) - Changed default-width and min-width on SidebarPanel (#1273) ### Fixed - Styling design system components used in the web component (#1263) - Sidebar panel overflow for plugins (#1266, #1269) - Extra border around code output in the instructions panel (#1253) - Line numbering alignment in code blocks in the instructions panel (#1259) - Extra lines added at the start of some code blocks (#1267)
In #1264 we added a `typography.style-1()` to the `.cm-scroller` class in the EditorPanel css, which unwittingly prevented font sizes from taking effect. This PR reverts that, but also tidies up the styling to use Design System typography styles instead, so line spacing etc goes with it. Also removes the `$space-0-5` var in favour of the Design System vars. e.g. Small: <img width="841" height="649" alt="image" src="https://github.com/user-attachments/assets/394b807d-a051-427c-b950-afbce7906a7c" /> Medium: <img width="857" height="596" alt="image" src="https://github.com/user-attachments/assets/ea3453ea-7f86-4bd1-a36e-6e7243706928" /> Large: <img width="861" height="496" alt="image" src="https://github.com/user-attachments/assets/3025bc83-eb31-429e-bff2-9c9eeebe1ea4" />
Status
closes #1259, #1253
What's changed
This also unifies the list of fonts used in the Editor to the list in settings/fonts. They can be added-to/changed by setting
--editor-font-family-sans-serifand--editor-font-family-monospace.Screenshots