From dcca5c1eb13c9830e12aa78f621d42348dfa9fd8 Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Wed, 16 Jun 2021 14:12:30 +0300 Subject: [PATCH] fix readonly for dictionary editor --- .../dictionary-manager.component.ts | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.ts b/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.ts index e40c5bb63..9e68c723f 100644 --- a/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.ts @@ -1,6 +1,5 @@ -import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core'; +import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core'; import { DictionaryControllerService } from '@redaction/red-ui-http'; -import { FormBuilder } from '@angular/forms'; import { AppStateService } from '@state/app-state.service'; import { debounce } from '@utils/debounce'; import { Observable } from 'rxjs'; @@ -20,7 +19,7 @@ const SMOOTH_SCROLL = 0; templateUrl: './dictionary-manager.component.html', styleUrls: ['./dictionary-manager.component.scss'] }) -export class DictionaryManagerComponent implements OnChanges { +export class DictionaryManagerComponent implements OnChanges, OnInit { @Input() withFloatingActions = true; @Input() @@ -33,12 +32,7 @@ export class DictionaryManagerComponent implements OnChanges { currentMatch = 0; findMatches: FindMatch[] = []; currentEntries: string[] = []; - editorOptions: IStandaloneEditorConstructionOptions = { - theme: 'vs', - language: 'text/plain', - automaticLayout: true, - readOnly: !this.canEdit - }; + editorOptions: IStandaloneEditorConstructionOptions = {}; diffEditorText = ''; showDiffEditor = false; searchText = ''; @@ -50,16 +44,23 @@ export class DictionaryManagerComponent implements OnChanges { private _diffEditor: IDiffEditor; private _decorations: string[] = []; private _searchDecorations: string[] = []; + private _dossier: DossierWrapper = this.selectDossier as DossierWrapper; constructor( private readonly _dictionaryControllerService: DictionaryControllerService, - private readonly _appStateService: AppStateService, - private readonly _formBuilder: FormBuilder + private readonly _appStateService: AppStateService ) { this.currentEntries = this.initialEntries; } - private _dossier: DossierWrapper = this.selectDossier as DossierWrapper; + ngOnInit(): void { + this.editorOptions = { + theme: 'vs', + language: 'text/plain', + automaticLayout: true, + readOnly: !this.canEdit + }; + } get dossier() { return this._dossier;