fix readonly for dictionary editor

This commit is contained in:
Dan Percic 2021-06-16 14:12:30 +03:00
parent e4ff415e28
commit dcca5c1eb1

View File

@ -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;