DM-473 revert to original behaviour

This commit is contained in:
Dan Percic 2023-09-15 14:43:07 +03:00
parent 258a304b94
commit 5be720bc7e
6 changed files with 16 additions and 17 deletions

View File

@ -5,7 +5,7 @@
<div class="dialog-content redaction"> <div class="dialog-content redaction">
<div class="iqser-input-group w-450"> <div class="iqser-input-group w-450">
<label [translate]="'add-annotation.dialog.content.selected-text'" class="selected-text"></label> <label [translate]="'add-annotation.dialog.content.selected-text'" class="selected-text"></label>
<span [innerHTML]="form.controls.selectedText.value" class="use-backslash-n-as-line-break"></span> <span [innerHTML]="form.controls.selectedText.value"></span>
</div> </div>
<div class="iqser-input-group required w-450"> <div class="iqser-input-group required w-450">

View File

@ -9,6 +9,7 @@ import { ActiveDossiersService } from '@services/dossiers/active-dossiers.servic
import { DictionaryService } from '@services/entity-services/dictionary.service'; import { DictionaryService } from '@services/entity-services/dictionary.service';
import { JustificationsService } from '@services/entity-services/justifications.service'; import { JustificationsService } from '@services/entity-services/justifications.service';
import { Roles } from '@users/roles'; import { Roles } from '@users/roles';
import { removeHyphensAndSpecialChars } from '@utils/functions';
import { firstValueFrom } from 'rxjs'; import { firstValueFrom } from 'rxjs';
import { ManualRedactionService } from '../../services/manual-redaction.service'; import { ManualRedactionService } from '../../services/manual-redaction.service';
@ -185,6 +186,7 @@ export class ManualAnnotationDialogComponent extends BaseDialogComponent impleme
addRedactionRequest.value = addRedactionRequest.rectangle addRedactionRequest.value = addRedactionRequest.rectangle
? this.form.get('classification').value ? this.form.get('classification').value
: this.form.get('selectedText').value; : this.form.get('selectedText').value;
addRedactionRequest.value = removeHyphensAndSpecialChars(addRedactionRequest.value);
} }
#selectReason() { #selectReason() {

View File

@ -14,11 +14,7 @@
></label> ></label>
<div [ngClass]="isEditingSelectedText ? 'flex relative' : 'flex-align-items-center'" class="fixed-height"> <div [ngClass]="isEditingSelectedText ? 'flex relative' : 'flex-align-items-center'" class="fixed-height">
<span <span *ngIf="!isEditingSelectedText" [innerHTML]="form.controls.selectedText.value"></span>
*ngIf="!isEditingSelectedText"
[innerHTML]="form.controls.selectedText.value"
class="use-backslash-n-as-line-break"
></span>
<textarea <textarea
*ngIf="isEditingSelectedText" *ngIf="isEditingSelectedText"

View File

@ -52,7 +52,7 @@ import JSZip from 'jszip';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import { combineLatest, first, firstValueFrom, of, pairwise } from 'rxjs'; import { combineLatest, first, firstValueFrom, of, pairwise } from 'rxjs';
import { catchError, filter, map, startWith, switchMap, tap } from 'rxjs/operators'; import { catchError, filter, map, startWith, switchMap, tap } from 'rxjs/operators';
import { byId, byPage, download, handleFilterDelta, hasChanges } from '../../utils'; import { byId, byPage, download, handleFilterDelta, hasChanges, removeHyphensAndSpecialChars } from '../../utils';
import { AnnotationDrawService } from '../pdf-viewer/services/annotation-draw.service'; import { AnnotationDrawService } from '../pdf-viewer/services/annotation-draw.service';
import { REDAnnotationManager } from '../pdf-viewer/services/annotation-manager.service'; import { REDAnnotationManager } from '../pdf-viewer/services/annotation-manager.service';
import { REDDocumentViewer } from '../pdf-viewer/services/document-viewer.service'; import { REDDocumentViewer } from '../pdf-viewer/services/document-viewer.service';
@ -533,6 +533,7 @@ export class FilePreviewScreenComponent
} }
const hint = manualRedactionEntryWrapper.type === ManualRedactionEntryTypes.HINT; const hint = manualRedactionEntryWrapper.type === ManualRedactionEntryTypes.HINT;
result.redaction.value = removeHyphensAndSpecialChars(result.redaction.value);
const add$ = this._manualRedactionService.addAnnotation([result.redaction], this.dossierId, this.fileId, { const add$ = this._manualRedactionService.addAnnotation([result.redaction], this.dossierId, this.fileId, {
hint, hint,
dictionaryLabel: result.dictionary?.label, dictionaryLabel: result.dictionary?.label,

View File

@ -266,19 +266,11 @@ export class PdfProxyService {
} }
} }
entry.value = this.#formatSelectedText(text); entry.value = text;
entry.rectangle = !text; entry.rectangle = !text;
return entry; return entry;
} }
#formatSelectedText(text: string): string {
return text?.replace(
// eslint-disable-next-line no-control-regex,max-len
/([^\s\d-]{2,})[-\u00AD]\u000D|[\u000B\u000C\u000D\u0085\u2028\u2029]/gi,
'$1',
);
}
#deactivateMultiSelect() { #deactivateMultiSelect() {
this._logger.info('[PDF] Deactivating multi-select'); this._logger.info('[PDF] Deactivating multi-select');
this._multiSelectService.deactivate(); this._multiSelectService.deactivate();

View File

@ -1,5 +1,5 @@
import type { List } from '@iqser/common-ui/lib/utils';
import { ITrackable } from '@iqser/common-ui'; import { ITrackable } from '@iqser/common-ui';
import type { List } from '@iqser/common-ui/lib/utils';
import type { AnnotationWrapper } from '@models/file/annotation.wrapper'; import type { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { Dayjs } from 'dayjs'; import { Dayjs } from 'dayjs';
@ -133,3 +133,11 @@ export function calcTextWidthInPixels(text: string): number {
return width; return width;
} }
export function removeHyphensAndSpecialChars(text: string): string {
return text?.replace(
// eslint-disable-next-line no-control-regex,max-len
/([^\s\d-]{2,})[-\u00AD]\u000A\u000D|[\u000A\u000B\u000C\u000D\u0085\u2028\u2029]/gi,
'$1',
);
}