This repository has been archived by the owner on Aug 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
182 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
src/app/modules/blockly-editor/components/code-view/code-view.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
<pre id="code-view" > | ||
<code [innerHTML]="codeEditor.tokenizedCode$ | async" class="language-arduino"></code> | ||
</pre> | ||
<monaco-editor | ||
class="code-view" | ||
[code]="codeEditor.code$ | async" | ||
readonly="true" | ||
/> |
6 changes: 1 addition & 5 deletions
6
src/app/modules/blockly-editor/components/code-view/code-view.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
#code-view { | ||
.code-view { | ||
width: 100%; | ||
height: 100%; | ||
margin: 0; | ||
overflow-x: scroll; | ||
} | ||
|
||
.language-arduino { | ||
height: 100%; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
<div id="container"> | ||
<div class="app-ace-editor" #editor></div> | ||
<monaco-editor | ||
class="monaco-editor" | ||
[code]="codeEditorState.code$ | async" | ||
(codeChange)="codeEditorState.setCode($event)" | ||
/> | ||
<app-button-bar></app-button-bar> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 6 additions & 1 deletion
7
src/app/modules/code-editor-python/code-editor-python.page.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
<div id="container"> | ||
<div class="app-ace-editor" #editor></div> | ||
<monaco-editor | ||
class="monaco-editor" | ||
[code]="codeEditorState.code$ | async" | ||
(codeChange)="codeEditorState.setCode($event)" | ||
language="python" | ||
/> | ||
<app-button-bar></app-button-bar> | ||
<app-terminal class="terminal" #terminal></app-terminal> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 9 additions & 9 deletions
18
src/app/modules/core/dialogs/confirm-editor/confirm-editor.dialog.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
<h1 mat-dialog-title> | ||
{{ "CONFIRMEDITORCHANGE_TITLE" | translate}} | ||
{{ "CONFIRMEDITORCHANGE_TITLE" | translate }} | ||
</h1> | ||
<div mat-dialog-content> | ||
<p>{{"EDITORCHANGEINSTRUCTIONS"|translate}}</p> | ||
<p>{{ "EDITORCHANGEINSTRUCTIONS"|translate }}</p> | ||
</div> | ||
<div mat-dialog-actions align="center"> | ||
<button mat-flat-button (click)="onEditorChangeConfirmed()"> | ||
{{"EDITORCHANGE_CONFIRM"|translate}} | ||
</button> | ||
<button mat-flat-button (click)="onEditorChangeCancelled()"> | ||
{{"EDITORCHANGE_CANCEL"|translate}} | ||
</button> | ||
<div mat-dialog-actions class="actions" align="center"> | ||
<button mat-flat-button (click)="close(false)"> | ||
{{ "EDITORCHANGE_CANCEL"|translate }} | ||
</button> | ||
<button mat-flat-button (click)="close(true)"> | ||
{{ "EDITORCHANGE_CONFIRM"|translate }} | ||
</button> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.actions { | ||
display: flex; | ||
justify-content: space-between; | ||
} |
31 changes: 13 additions & 18 deletions
31
src/app/modules/core/dialogs/confirm-editor/confirm-editor.dialog.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,19 @@ | ||
import { Component } from '@angular/core'; | ||
import { MatDialogRef } from '@angular/material/dialog'; | ||
import { AppState } from 'src/app/state/app.state'; | ||
import {Component, Inject} from '@angular/core'; | ||
import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; | ||
import {AppState} from 'src/app/state/app.state'; | ||
|
||
@Component({ | ||
selector: 'app-confirm-editor', | ||
templateUrl: './confirm-editor.dialog.html', | ||
styleUrls: ['../dialog-styles.scss', './confirm-editor.dialog.scss'] | ||
selector: 'app-confirm-editor', | ||
templateUrl: './confirm-editor.dialog.html', | ||
styleUrls: ['../dialog-styles.scss', './confirm-editor.dialog.scss'] | ||
}) | ||
|
||
export class ConfirmEditorDialog { | ||
constructor( | ||
public dialogRef: MatDialogRef<ConfirmEditorDialog>, | ||
public appState: AppState | ||
) { } | ||
constructor( | ||
public dialogRef: MatDialogRef<ConfirmEditorDialog>, | ||
public appState: AppState, | ||
) { } | ||
|
||
public onEditorChangeConfirmed() { | ||
this.appState.setIsCodeEditorToggleConfirmed(true); | ||
this.dialogRef.close(); | ||
} | ||
public onEditorChangeCancelled() { | ||
this.dialogRef.close(); | ||
} | ||
public close(confirm: boolean) { | ||
this.dialogRef.close(confirm) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<div class="editor" #element></div> |
4 changes: 4 additions & 0 deletions
4
src/app/modules/shared/components/monaco/monaco.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.editor { | ||
width: 100%; | ||
height: 100%; | ||
} |
54 changes: 54 additions & 0 deletions
54
src/app/modules/shared/components/monaco/monaco.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { | ||
AfterViewInit, | ||
Component, | ||
ElementRef, | ||
EventEmitter, | ||
Input, | ||
OnChanges, | ||
Output, | ||
SimpleChanges, | ||
ViewChild | ||
} from "@angular/core"; | ||
import * as monaco from 'monaco-editor' | ||
|
||
@Component({ | ||
selector: "monaco-editor", | ||
styleUrls: ["./monaco.component.scss"], | ||
templateUrl: "./monaco.component.html", | ||
}) | ||
export class MonacoComponent implements AfterViewInit, OnChanges { | ||
@Input() language = 'cpp' | ||
|
||
@Input() code = '' | ||
@Output() codeChange = new EventEmitter<string>() | ||
|
||
@Input() readonly = false | ||
|
||
@ViewChild('element') element: ElementRef<HTMLDivElement> | ||
private editor?: monaco.editor.IStandaloneCodeEditor | ||
|
||
ngAfterViewInit() { | ||
this.editor = monaco.editor.create(this.element.nativeElement, { | ||
value: this.code, | ||
language: this.language, | ||
automaticLayout: true, | ||
readOnly: this.readonly, | ||
}) | ||
|
||
this.editor.getModel().onDidChangeContent(() => { | ||
this.setCode(this.editor.getValue()) | ||
}) | ||
} | ||
|
||
ngOnChanges(changes: SimpleChanges) { | ||
if (!this.editor) return | ||
if (this.editor.getValue() !== changes.code.currentValue) { | ||
this.editor.setValue(changes.code.currentValue) | ||
} | ||
} | ||
|
||
public setCode(code: string) { | ||
this.code = code | ||
this.codeChange.emit(code) | ||
} | ||
} |
Oops, something went wrong.