Skip to content

Commit

Permalink
refactor: hide 'editor' implementation details for json-editor component
Browse files Browse the repository at this point in the history
  • Loading branch information
belsman committed Sep 23, 2024
1 parent 2204ec0 commit 6ded0d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class OrderEditComponent {
this.update({
items: [
{
...JSON.parse(this.jsonEditor.editor.getValue()),
...JSON.parse(this.jsonEditor.getValue()),
},
],
mode: ModeType.Update,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
OnDestroy,
} from '@angular/core';
import ace from 'ace-builds';
// TODO use minified.
import 'ace-builds/src-noconflict/mode-json';
import 'ace-builds/src-noconflict/theme-github_light_default';

Expand All @@ -18,13 +17,16 @@ import 'ace-builds/src-noconflict/theme-github_light_default';
export class JSONEditorComponent implements AfterViewInit, OnDestroy {
@HostBinding('class') classNames = 'col w-100p';

editor!: ace.Ace.Editor;
// TODO Make this private and provide an external data accessor value
private editor!: ace.Ace.Editor;

@Input() value = '';

constructor(private elRef: ElementRef) {}

getValue() {
return this.editor.getValue();
}

ngAfterViewInit(): void {
const containerElement: HTMLDivElement =
this.elRef.nativeElement.querySelector('div#container');
Expand Down

0 comments on commit 6ded0d2

Please sign in to comment.