RED-8786 - Preserve New-Lines in Component values in the UI
This commit is contained in:
parent
ee70abbfbe
commit
3c64d2ebcf
@ -2,8 +2,10 @@
|
||||
<div class="component">{{ entry.name }}</div>
|
||||
<div class="value" *ngIf="!editing; else editValue">
|
||||
<div class="text">
|
||||
<span *ngFor="let componentValue of entry.componentValues">
|
||||
{{ componentValue.value ?? componentValue.originalValue }}
|
||||
<span
|
||||
*ngFor="let componentValue of entry.componentValues"
|
||||
[innerHTML]="transformNewLines(componentValue.value ?? componentValue.originalValue)"
|
||||
>
|
||||
</span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
@ -23,7 +25,7 @@
|
||||
<form [formGroup]="form" (submit)="save()">
|
||||
<div cdkDropList (cdkDropListDropped)="drop($event)">
|
||||
<div *ngFor="let control of form.controls | keyvalue" class="editing-value" cdkDrag>
|
||||
<mat-icon class="draggable" svgIcon="red:draggable-dots"></mat-icon>
|
||||
<mat-icon class="draggable" svgIcon="red:draggable-dots" cdkDragHandle></mat-icon>
|
||||
<div class="iqser-input-group w-full">
|
||||
<textarea [formControlName]="control.key" rows="1" type="text"></textarea>
|
||||
</div>
|
||||
|
||||
@ -147,22 +147,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* .cdk-drag-preview {
|
||||
box-sizing: border-box;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2),
|
||||
0 8px 10px 1px rgba(0, 0, 0, 0.14),
|
||||
0 3px 14px 2px rgba(0, 0, 0, 0.12);
|
||||
}
|
||||
.cdk-drag-preview {
|
||||
display: flex;
|
||||
|
||||
.cdk-drag-placeholder {
|
||||
opacity: 0;
|
||||
.draggable {
|
||||
margin-top: 7px;
|
||||
cursor: grab;
|
||||
transform: scale(0.7);
|
||||
}
|
||||
}
|
||||
|
||||
.cdk-drag-animating {
|
||||
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
.cdk-drop-list-dragging {
|
||||
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
|
||||
} */
|
||||
|
||||
@ -4,7 +4,7 @@ import { FormBuilder, FormControl, ReactiveFormsModule, UntypedFormGroup } from
|
||||
import { BaseFormComponent, CircleButtonComponent, IconButtonComponent, IqserDialog } from '@iqser/common-ui';
|
||||
import { FilterService } from '@common-ui/filtering';
|
||||
import { RevertValueDialogComponent } from '../../dialogs/docu-mine/revert-value-dialog/revert-value-dialog.component';
|
||||
import { CdkDrag, CdkDragDrop, CdkDropList, moveItemInArray } from '@angular/cdk/drag-drop';
|
||||
import { CdkDrag, CdkDragDrop, CdkDragHandle, CdkDropList, moveItemInArray } from '@angular/cdk/drag-drop';
|
||||
import { KeyValuePipe, NgClass, NgForOf, NgIf } from '@angular/common';
|
||||
import { MatIcon } from '@angular/material/icon';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
@ -26,6 +26,7 @@ import { TranslateModule } from '@ngx-translate/core';
|
||||
CdkDrag,
|
||||
NgIf,
|
||||
NgForOf,
|
||||
CdkDragHandle,
|
||||
],
|
||||
})
|
||||
export class EditableStructuredComponentValueComponent extends BaseFormComponent implements OnInit {
|
||||
@ -117,4 +118,8 @@ export class EditableStructuredComponentValueComponent extends BaseFormComponent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
transformNewLines(value: string) {
|
||||
return value.replace(/\n/g, '<br>');
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user