Edit Designer tabs ui and fix canvas scroll bar
[ccsdk/cds.git] / cds-ui / designer-client / src / app / modules / feature-modules / packages / source-editor / source-editor.component.ts
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';
5 // import 'brace';
6 // import 'brace/ext/language_tools';
7 // import 'ace-builds/src-min-noconflict/snippets/html';
8
9 @Component({
10     selector: 'app-source-editor',
11     templateUrl: './source-editor.component.html',
12     styleUrls: ['./source-editor.component.css']
13 })
14 export class SourceEditorComponent implements OnInit, AfterViewInit {
15
16
17     @Input() text: string;
18     @Output() textChange = new EventEmitter();
19     @Input() lang: string;
20     @ViewChild('editor', { static: false }) editor: AceEditorComponent;
21
22     ngOnInit(): void {
23         //  throw new Error("Method not implemented.");
24     }
25
26
27     ngAfterViewInit() {
28
29         console.log(this.lang);
30         this.editor.setTheme('eclipse');
31         this.editor.getEditor().setOptions({
32             enableBasicAutocompletion: true,
33             // fontSize: '14pt',
34             // maxLines: 4096,
35             // behavioursEnabled: true,
36             // wrapBehavioursEnabled: true,
37             // showPrintMargin: true,
38             // indentedSoftWrap: true,
39             // wrap: true,
40         });
41
42         this.editor.getEditor().commands.addCommand({
43             name: 'showOtherCompletions',
44             bindKey: 'Ctrl-.',
45             exec(editor) {
46
47             }
48         });
49     }
50
51     onChange(editor) {
52         this.textChange.emit(this.text);
53     }
54 }