From 0a907ab983596975d1d03507adf2b23a1ec26975 Mon Sep 17 00:00:00 2001 From: ahmedeldeeb50 Date: Thu, 13 Feb 2020 12:09:13 +0200 Subject: updating source-editor changes Issue-ID: CCSDK-2070 Signed-off-by: ahmedeldeeb50 Change-Id: I203f89eb81ea9685ca69226b108c121a8be5f193 --- .../source-editor/source-editor.component.ts | 29 +++++++++++++--------- 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/source-editor/source-editor.component.ts') diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/source-editor/source-editor.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/source-editor/source-editor.component.ts index a63dfa7e0..8f4c376a3 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/source-editor/source-editor.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/source-editor/source-editor.component.ts @@ -1,4 +1,5 @@ -import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core'; +import { AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; +import { AceEditorComponent } from 'ng2-ace-editor'; // import 'brace/ext/searchbox'; // import 'ace-builds/webpack-resolver'; // import 'brace'; @@ -13,12 +14,10 @@ import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild export class SourceEditorComponent implements OnInit, AfterViewInit { - @Input() Data: string; - @Output() DataChange = new EventEmitter(); + @Input() text: string; + @Output() textChange = new EventEmitter(); @Input() lang: string; - mode = 'json'; - @ViewChild('editor', {static: false}) editor; - text = ''; + @ViewChild('editor', { static: false }) editor: AceEditorComponent; ngOnInit(): void { // throw new Error("Method not implemented."); @@ -26,10 +25,18 @@ export class SourceEditorComponent implements OnInit, AfterViewInit { ngAfterViewInit() { - this.editor.setTheme('eclipse'); + console.log(this.lang); + this.editor.setTheme('eclipse'); this.editor.getEditor().setOptions({ - enableBasicAutocompletion: true + enableBasicAutocompletion: true, + // fontSize: '14pt', + // maxLines: 4096, + // behavioursEnabled: true, + // wrapBehavioursEnabled: true, + // showPrintMargin: true, + // indentedSoftWrap: true, + // wrap: true, }); this.editor.getEditor().commands.addCommand({ @@ -41,9 +48,7 @@ export class SourceEditorComponent implements OnInit, AfterViewInit { }); } - onChange($event: {}) { - console.log('editor action'); - console.log(this.Data); - console.log($event); + onChange(editor) { + this.textChange.emit(this.text); } } -- cgit 1.2.3-korg