1 import { AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
2 import { AceEditorComponent } from 'ng2-ace-editor';
3 // import 'brace/ext/searchbox';
4 // import 'ace-builds/webpack-resolver';
6 // import 'brace/ext/language_tools';
7 // import 'ace-builds/src-min-noconflict/snippets/html';
10 selector: 'app-source-editor',
11 templateUrl: './source-editor.component.html',
12 styleUrls: ['./source-editor.component.css']
14 export class SourceEditorComponent implements OnInit, AfterViewInit {
17 @Input() text: string;
18 @Output() textChange = new EventEmitter();
19 @Input() lang: string;
20 @ViewChild('editor', { static: false }) editor: AceEditorComponent;
23 // throw new Error("Method not implemented.");
29 console.log(this.lang);
30 this.editor.setTheme('eclipse');
31 this.editor.getEditor().setOptions({
32 enableBasicAutocompletion: true,
35 // behavioursEnabled: true,
36 // wrapBehavioursEnabled: true,
37 // showPrintMargin: true,
38 // indentedSoftWrap: true,
42 this.editor.getEditor().commands.addCommand({
43 name: 'showOtherCompletions',
52 this.textChange.emit(this.text);