a63dfa7e0e042dc47811d420489a17fb02d02ca3
[ccsdk/cds.git] /
1 import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core';
2 // import 'brace/ext/searchbox';
3 // import 'ace-builds/webpack-resolver';
4 // import 'brace';
5 // import 'brace/ext/language_tools';
6 // import 'ace-builds/src-min-noconflict/snippets/html';
7
8 @Component({
9     selector: 'app-source-editor',
10     templateUrl: './source-editor.component.html',
11     styleUrls: ['./source-editor.component.css']
12 })
13 export class SourceEditorComponent implements OnInit, AfterViewInit {
14
15
16     @Input() Data: string;
17     @Output() DataChange = new EventEmitter();
18     @Input() lang: string;
19     mode = 'json';
20     @ViewChild('editor', {static: false}) editor;
21     text = '';
22
23     ngOnInit(): void {
24         //  throw new Error("Method not implemented.");
25     }
26
27
28     ngAfterViewInit() {
29         this.editor.setTheme('eclipse');
30
31         this.editor.getEditor().setOptions({
32             enableBasicAutocompletion: true
33         });
34
35         this.editor.getEditor().commands.addCommand({
36             name: 'showOtherCompletions',
37             bindKey: 'Ctrl-.',
38             exec(editor) {
39
40             }
41         });
42     }
43
44     onChange($event: {}) {
45         console.log('editor action');
46         console.log(this.Data);
47         console.log($event);
48     }
49 }