Skip to content

Commit 75a7bd2

Browse files
create-issue-branch[bot]patch0cocomarine
authored
[CC Projects] Lines are sometimes off by one line (#1264)
## Status closes #1259, #1253 ## What's changed * Remove border on code output blocks * Fix alignment of line numbers in code blocks by * Using variables to set fonts consistently in the interface * Fixing line spacing in a number of spots using the typography mixins supplied by the design system. 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-serif` and `--editor-font-family-monospace`. ## Screenshots | Problem | Before | After | |--------|--------|--------| | Emojis breaking highligting | <img width="444" height="400" alt="image" src="https://github.com/user-attachments/assets/7611d6e6-ef75-4e83-9ca4-c8933c208326" /> | <img width="444" height="439" alt="image" src="https://github.com/user-attachments/assets/1647e971-ec8a-4078-8ddf-9eea737541af" /> | | Another example | <img width="596" height="292" alt="image" src="https://github.com/user-attachments/assets/c90acdc8-d742-4fbd-942f-e92d052b8bd5" /> | <img width="519" height="333" alt="image" src="https://github.com/user-attachments/assets/daa129b5-1e00-4a32-9bf9-6273982cf857" /> | | Fixes border on output | <img width="575" height="123" alt="image" src="https://github.com/user-attachments/assets/dad91111-b952-4bff-a0d3-38b84a2df708" /> | <img width="530" height="113" alt="image" src="https://github.com/user-attachments/assets/f617e682-2fdb-4d8b-96c5-c36ff6ea6988" /> | --------- Co-authored-by: create-issue-branch[bot] <53036503+create-issue-branch[bot]@users.noreply.github.com> Co-authored-by: Patrick Cherry <[email protected]> Co-authored-by: HJ <[email protected]>
1 parent f6f6727 commit 75a7bd2

File tree

9 files changed

+48
-30
lines changed

9 files changed

+48
-30
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## Unreleased
88

9+
### Added
10+
11+
- Font-family variables that can be used to customise the sans-serif and monospace fonts used in the editor (#1264)
12+
913
### Changed
1014

1115
- Changed the horizontal scrollbar to show without needing to scroll to the bottom of the editor window (#1257)
@@ -19,6 +23,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1923

2024
- Styling design system components used in the web component (#1263)
2125
- Sidebar panel overflow for plugins (#1266, #1269)
26+
- Extra border around code output in the instructions panel (#1253)
27+
- Line numbering alignment in code blocks in the instructions panel (#1259)
2228

2329
## [0.33.0] - 2025-10-15
2430

src/assets/stylesheets/App.scss

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ button {
2121
}
2222

2323
input {
24-
font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Oxygen',
25-
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
26-
sans-serif;
24+
font-family: var(--wc-font-family-sans-serif);
2725
}
2826

2927
.--light {
@@ -60,9 +58,7 @@ input {
6058
#app {
6159
display: flex;
6260
flex-flow: column;
63-
font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Oxygen',
64-
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
65-
sans-serif;
61+
font-family: var(--wc-font-family-sans-serif);
6662
@include font-size-1(regular);
6763
}
6864

src/assets/stylesheets/AstroPiModel.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@
9999
display: flex;
100100
align-items: center;
101101
justify-content: center;
102-
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
103-
monospace;
102+
font-family: var(--wc-font-family-monospace);
104103

105104
&-timer {
106105
margin-block-start: 0;

src/assets/stylesheets/Button.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
color: inherit;
1111
cursor: pointer;
1212
display: inline-flex;
13-
font-family: sans-serif;
13+
font-family: var(--wc-font-family-sans-serif);
1414
font-size: inherit;
1515
font-weight: $font-weight-bold;
1616
gap: $space-0-5;

src/assets/stylesheets/EditorPanel.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@use "./rpf_design_system/spacing" as *;
22
@use "./rpf_design_system/font-size" as *;
3+
@use "../../../node_modules/@raspberrypifoundation/design-system-core/scss/mixins/typography";
34

45
// Scrollbar-width is needed from scrollbar to show in Chrome
56
.editor-wrapper {
@@ -25,10 +26,14 @@
2526
}
2627

2728
.cm-scroller {
29+
@include typography.style-1();
30+
2831
// Needed here for horizontal scroll
2932
overflow: auto;
3033
scrollbar-width: thin;
3134
overscroll-behavior-x: none;
35+
font-family: var(--wc-font-family-monospace);
36+
3237

3338
.cm-content {
3439
flex: 1;

src/assets/stylesheets/Instructions.scss

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,25 @@
33
@use "../../../node_modules/@raspberrypifoundation/design-system-core/scss/mixins/typography";
44
@use "./rpf_design_system/colours" as *;
55
@use "./rpf_design_system/spacing" as *;
6-
@use "./rpf_design_system/font-size" as *;
7-
@use "./rpf_design_system/font-weight" as *;
86

97
.project-instructions {
108
block-size: 100%;
119

1210
h2 {
13-
@include font-size-1-25(bold);
11+
@include typography.style-1-5(bold);
1412
margin: 0;
1513
}
1614

15+
p {
16+
@include typography.style-1();
17+
}
18+
1719
a {
1820
color: var(--editor-color-theme-secondary);
1921
}
2022

2123
strong {
22-
font-weight: $font-weight-bold;
24+
font-weight: var(--font-weight-bold);
2325
}
2426

2527
img {
@@ -48,6 +50,8 @@
4850
}
4951

5052
pre {
53+
@include typography.style-1();
54+
5155
background-color: $rpf-grey-700;
5256
border: 1px solid $rpf-grey-600;
5357
border-radius: 8px;
@@ -76,7 +80,7 @@
7680
}
7781

7882
.c-code-filename {
79-
font-family: monospace;
83+
font-family: var(--wc-font-family-monospace);
8084
margin: 0;
8185
padding: $space-0-5 $space-1;
8286
color: $rpf-white;
@@ -239,9 +243,10 @@
239243
margin: $space-1-5 0;
240244

241245
h3 {
246+
@include typography.style-1(bold);
247+
242248
margin: 0;
243249
padding-inline-start: $space-2;
244-
@include font-size-1(bold);
245250
background-repeat: no-repeat;
246251
background-position: inline-start $space-0-5 center;
247252
}
@@ -279,10 +284,11 @@
279284
margin-block-end: $space-1-5;
280285

281286
pre {
282-
padding: 0;
283-
margin: 0;
284-
inline-size: 100%;
285287
background-color: $rpf-white;
288+
border: none;
289+
inline-size: 100%;
290+
margin: 0;
291+
padding: 0;
286292
}
287293

288294
code {

src/assets/stylesheets/InternalStyles.scss

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,21 @@
4343
@use "./FilePanel" as *; // needs to be below Button
4444
@use "./EmbeddedViewer" as *;
4545

46+
@use "./settings/fonts" as fonts;
47+
4648
:host {
4749
font-size: 1.6rem;
4850
}
4951

5052
#wc {
53+
// Allow fonts to be overridden by the host application via
54+
// --editor-font-family-*, falling back to the default sets in
55+
// settings/fonts.scss
56+
--wc-font-family-sans-serif: var(--editor-font-family-sans-serif, #{fonts.$font-family-sans-serif});
57+
--wc-font-family-monospace: var(--editor-font-family-monospace, #{fonts.$font-family-monospace});
58+
5159
background: var(--editor-secondary-theme, transparent);
52-
font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", "Oxygen",
53-
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
54-
sans-serif;
60+
font-family: var(--wc-font-family-sans-serif);
5561
font-size: 16px;
5662
-webkit-font-smoothing: antialiased;
5763
-moz-osx-font-smoothing: grayscale;
@@ -83,8 +89,7 @@
8389
}
8490

8591
code {
86-
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
87-
monospace;
92+
font-family: var(--wc-font-family-monospace);
8893
}
8994

9095
button {

src/assets/stylesheets/index.scss

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
@use "./rpf_design_system/colours" as *;
2+
@use './settings/fonts' as fonts;
23

34
html,
45
body {
56
margin: 0;
67
}
78

8-
:host {
9-
font-size: 16px;
9+
:root {
10+
--editor-font-family-sans-serif: fonts.$font-family-sans-serif;
11+
--editor-font-family-monospace: fonts.$font-family-monospace;
1012
}
1113

1214
body {
13-
font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", "Oxygen",
14-
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
15-
sans-serif;
15+
font-family: var(--editor-font-family-sans-serif);
1616
-webkit-font-smoothing: antialiased;
1717
-moz-osx-font-smoothing: grayscale;
1818
}
1919

2020
code {
21-
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
22-
monospace;
21+
font-family: var(--editor-font-family-monospace);
2322
}
2423

2524
#app {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
$font-family-sans-serif: Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
2+
$font-family-monospace: RobotoMono, source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;

0 commit comments

Comments
 (0)