diff --git a/frontend/app/shared/components/assets/asset-text-editor.component.html b/frontend/app/shared/components/assets/asset-text-editor.component.html
index 624a51022..62c981d79 100644
--- a/frontend/app/shared/components/assets/asset-text-editor.component.html
+++ b/frontend/app/shared/components/assets/asset-text-editor.component.html
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/frontend/app/shared/components/assets/asset-text-editor.component.ts b/frontend/app/shared/components/assets/asset-text-editor.component.ts
index 17335ff23..949f68db3 100644
--- a/frontend/app/shared/components/assets/asset-text-editor.component.ts
+++ b/frontend/app/shared/components/assets/asset-text-editor.component.ts
@@ -6,20 +6,15 @@
*/
import { HttpClient } from '@angular/common/http';
-import { ChangeDetectorRef, Component, Input, OnInit } from '@angular/core';
-import { StatefulComponent } from '@app/framework';
-
-interface Snapshot {
- // The text to edit.
- text?: string;
-}
+import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit } from '@angular/core';
@Component({
selector: 'sqx-asset-text-editor',
styleUrls: ['./asset-text-editor.component.scss'],
- templateUrl: './asset-text-editor.component.html'
+ templateUrl: './asset-text-editor.component.html',
+ changeDetection: ChangeDetectionStrategy.OnPush
})
-export class AssetTextEditorComponent extends StatefulComponent implements OnInit {
+export class AssetTextEditorComponent implements OnInit {
@Input()
public fileSource: string;
@@ -29,22 +24,26 @@ export class AssetTextEditorComponent extends StatefulComponent implem
@Input()
public mimeType: string;
- constructor(changeDetector: ChangeDetectorRef,
+ public text = '';
+
+ constructor(
+ private readonly changeDetector: ChangeDetectorRef,
private readonly httpClient: HttpClient
) {
- super(changeDetector, {});
}
public ngOnInit() {
this.httpClient.get(this.fileSource, { responseType: 'text' })
.subscribe(text => {
- this.next({ text });
+ this.text = text;
+
+ this.changeDetector.detectChanges();
});
}
public toFile(): Promise {
return new Promise(resolve => {
- const blob = new Blob([this.snapshot.text || ''], {
+ const blob = new Blob([this.text || ''], {
type: this.mimeType
});