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

Change font size in code editor #535

Merged
merged 2 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
<div class="inline-block"
style="display: flex; background-color:whitesmoke; justify-content: space-between;margin:auto;">
<span style="flex:1 1 auto;"></span>
<button class="btn btn-light btn-sm mb-1 mt-2 mr-1 " matTooltip="Increase font size" style="font-size: 16px; max-height:30px;background: transparent;"
(click)="IncreaseFont()"><i>A+</i></button>
<button class="btn btn-light btn-sm mb-1 mt-2 mr-1 " matTooltip="Decrease font size" style="font-size: 16px; max-height:30px;background: transparent;"
(click)="DecreaseFont()"><i>A-</i></button>
<button class="btn btn-light btn-sm mb-1 mt-2 mr-1 " matTooltip="Download ino file" style="font-size: 16px; max-height:30px;background: transparent;"
(click)="DownloadCode()"><i class="fa fa-download"></i></button>
<button class="btn btn-light btn-sm mb-1 mt-2 mr-1 " matTooltip="Include Library" style="font-size:16px; max-height:30px;background: transparent;"
Expand Down
18 changes: 17 additions & 1 deletion ArduinoFrontend/src/app/code-editor/code-editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ export class CodeEditorComponent {
/**
* Monaco code editor options
*/
size = 15;
editorOptions = {
theme: 'vs',
language: 'c'
language: 'c',
fontSize: 15
};
/**
* Instance of Monaco editor
Expand Down Expand Up @@ -144,6 +146,20 @@ export class CodeEditorComponent {
}
}
}
/**
* Increase the size of the font in the editor
*/
IncreaseFont(fontSize: number) {
this.size = this.size + 1;
this.editorOptions = {...this.editorOptions, fontSize: this.size};
}
/**
* Decrease the size of the font in the editor
*/
DecreaseFont(fontSize: number) {
this.size = this.size - 1;
this.editorOptions = {...this.editorOptions, fontSize: this.size};
}
/**
* Download the code from code editor
*/
Expand Down
Loading