|
|
|
@ -1,11 +1,12 @@
|
|
|
|
|
import { Component, Input, ViewChild } from '@angular/core';
|
|
|
|
|
import { CodeExecutionService } from 'src/app/services/codeExecution.service';
|
|
|
|
|
import { BackendService } from 'src/app/services/backendService.service';
|
|
|
|
|
import { Compartment, StateEffect } from '@codemirror/state';
|
|
|
|
|
import { CodeMirrorComponent } from '@sandkasten/codemirror6-editor';
|
|
|
|
|
import { LanguageDescription } from '@codemirror/language';
|
|
|
|
|
import { CODE_DEFAULTS, LANGUAGES } from '../languages';
|
|
|
|
|
import { SafeHTMLPipe } from '../../safe-html.pipe';
|
|
|
|
|
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
|
|
|
import { Router } from '@angular/router';
|
|
|
|
|
import {
|
|
|
|
|
keymap,
|
|
|
|
|
highlightSpecialChars,
|
|
|
|
@ -157,13 +158,22 @@ export class EditorComponent {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
constructor(private codeExecutionService: CodeExecutionService) {}
|
|
|
|
|
constructor(
|
|
|
|
|
private router: Router,
|
|
|
|
|
private codeExecutionService: BackendService
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
// Efface le contenu de l'éditeur
|
|
|
|
|
clear(): void {
|
|
|
|
|
this.editorContent = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async onCreateRoomButtonClicked() {
|
|
|
|
|
const idRoom = await this.codeExecutionService.createRoom();
|
|
|
|
|
console.log(idRoom);
|
|
|
|
|
this.router.navigate([`./editor-live/${idRoom}`]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onRunButtonClicked() {
|
|
|
|
|
// Le code à exécuter est le contenu de l'éditeur
|
|
|
|
|
const codeToExecute = this.editorContent;
|
|
|
|
|