use \n as line break
This commit is contained in:
parent
33e0ba3d57
commit
258a304b94
@ -5,7 +5,7 @@
|
||||
<div class="dialog-content redaction">
|
||||
<div class="iqser-input-group w-450">
|
||||
<label [translate]="'add-annotation.dialog.content.selected-text'" class="selected-text"></label>
|
||||
{{ form.get('selectedText').value }}
|
||||
<span [innerHTML]="form.controls.selectedText.value" class="use-backslash-n-as-line-break"></span>
|
||||
</div>
|
||||
|
||||
<div class="iqser-input-group required w-450">
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
import { Component, inject, OnInit } from '@angular/core';
|
||||
import { FormBuilder } from '@angular/forms';
|
||||
import { IconButtonTypes, IqserDialogComponent, IqserPermissionsService } from '@iqser/common-ui';
|
||||
import { IconButtonTypes, IqserDialogComponent } from '@iqser/common-ui';
|
||||
import { Dictionary, IAddRedactionRequest } from '@red/domain';
|
||||
import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service';
|
||||
import { DictionaryService } from '@services/entity-services/dictionary.service';
|
||||
import { Roles } from '@users/roles';
|
||||
import { AddAnnotationData, AddAnnotationResult } from '../../../utils/dialog-types';
|
||||
|
||||
@Component({
|
||||
@ -15,17 +14,19 @@ export class AddAnnotationDialogComponent
|
||||
implements OnInit
|
||||
{
|
||||
readonly #dossier = inject(ActiveDossiersService).find(this.data.dossierId);
|
||||
readonly #isRss = inject(IqserPermissionsService).has(Roles.getRss);
|
||||
readonly iconButtonTypes = IconButtonTypes;
|
||||
dictionaries: Dictionary[] = [];
|
||||
readonly form = this.#getForm();
|
||||
|
||||
constructor(private readonly _dictionaryService: DictionaryService, private readonly _formBuilder: FormBuilder) {
|
||||
constructor(
|
||||
private readonly _dictionaryService: DictionaryService,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
get displayedDictionaryLabel() {
|
||||
const dictType = this.form.get('dictionary').value;
|
||||
const dictType = this.form.controls.dictionary.value;
|
||||
if (dictType) {
|
||||
return this.dictionaries.find(d => d.type === dictType)?.label ?? null;
|
||||
}
|
||||
@ -33,7 +34,7 @@ export class AddAnnotationDialogComponent
|
||||
}
|
||||
|
||||
get disabled() {
|
||||
return !this.#isRss || !this.form.get('dictionary').value;
|
||||
return !this.form.controls.dictionary.value;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@ -45,7 +46,7 @@ export class AddAnnotationDialogComponent
|
||||
const redaction = this.data.manualRedactionEntryWrapper.manualRedactionEntry;
|
||||
this.close({
|
||||
redaction,
|
||||
dictionary: this.dictionaries.find(d => d.type === this.form.get('dictionary').value),
|
||||
dictionary: this.dictionaries.find(d => d.type === this.form.controls.dictionary.value),
|
||||
});
|
||||
}
|
||||
|
||||
@ -58,16 +59,16 @@ export class AddAnnotationDialogComponent
|
||||
}
|
||||
|
||||
#enhanceManualRedaction(addRedactionRequest: IAddRedactionRequest) {
|
||||
addRedactionRequest.type = this.form.get('dictionary').value;
|
||||
addRedactionRequest.type = this.form.controls.dictionary.value;
|
||||
|
||||
const selectedType = this.dictionaries.find(d => d.type === addRedactionRequest.type);
|
||||
addRedactionRequest.addToDictionary = !!selectedType?.hasDictionary;
|
||||
addRedactionRequest.reason ??= 'Dictionary Request';
|
||||
|
||||
const commentValue = this.form.get('comment').value;
|
||||
const commentValue = this.form.controls.comment.value;
|
||||
addRedactionRequest.comment = commentValue ? { text: commentValue } : null;
|
||||
addRedactionRequest.section = null;
|
||||
addRedactionRequest.value = this.form.get('selectedText').value;
|
||||
addRedactionRequest.value = this.form.controls.selectedText.value;
|
||||
addRedactionRequest.addToAllDossiers = addRedactionRequest.addToDictionary || !!this.data.applyToAllDossiers;
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,7 +14,11 @@
|
||||
></label>
|
||||
|
||||
<div [ngClass]="isEditingSelectedText ? 'flex relative' : 'flex-align-items-center'" class="fixed-height">
|
||||
<span *ngIf="!isEditingSelectedText" [innerHTML]="form.controls.selectedText.value" class="use-n-as-line-break"></span>
|
||||
<span
|
||||
*ngIf="!isEditingSelectedText"
|
||||
[innerHTML]="form.controls.selectedText.value"
|
||||
class="use-backslash-n-as-line-break"
|
||||
></span>
|
||||
|
||||
<textarea
|
||||
*ngIf="isEditingSelectedText"
|
||||
|
||||
@ -43,7 +43,3 @@
|
||||
textarea {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.use-n-as-line-break {
|
||||
white-space: pre-line !important;
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit d1df30b56ea5abd03b0c8623f68fc96db9fef271
|
||||
Subproject commit a4132b82f52e92025f2348fb83587680790ca3a8
|
||||
Loading…
x
Reference in New Issue
Block a user