Text highlight cleanup

This commit is contained in:
Timo Bejan 2022-02-28 19:32:21 +02:00
parent 5612fc01ea
commit c807524991
3 changed files with 21 additions and 5 deletions

View File

@ -152,10 +152,19 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
return;
}
const textHighlightAnnotationIds = this._fileData.textHighlightAnnotations.map(a => a.id);
const textHighlightAnnotations = this._getAnnotations((a: Core.Annotations.Annotation) =>
textHighlightAnnotationIds.includes(a.Id),
);
this._instance.Core.annotationManager.deleteAnnotations(textHighlightAnnotations, {
imported: true,
force: true,
});
const ocrAnnotationIds = this._fileData.allAnnotations.filter(a => a.isOCR).map(a => a.id);
const annotations = this._getAnnotations(a => a.getCustomData('redact-manager'));
const redactions = annotations.filter(a => a.getCustomData('redaction'));
const highlights = annotations.filter(a => a.getCustomData('highlight'));
switch (this.viewModeService.viewMode) {
case 'STANDARD': {
@ -166,7 +175,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
const nonStandardEntries = annotations.filter(a => a.getCustomData('changeLogRemoved') === 'true');
this._setAnnotationsOpacity(standardEntries, true);
this._show(standardEntries);
this._hide([...nonStandardEntries, ...highlights]);
this._hide([...nonStandardEntries]);
break;
}
case 'DELTA': {
@ -175,7 +184,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
this._setAnnotationsColor(redactions, 'annotationColor');
this._setAnnotationsOpacity(changeLogEntries, true);
this._show(changeLogEntries);
this._hide([...nonChangeLogEntries, ...highlights]);
this._hide([...nonChangeLogEntries]);
break;
}
case 'REDACTED': {
@ -183,7 +192,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
this._setAnnotationsOpacity(redactions);
this._setAnnotationsColor(redactions, 'redactionColor');
this._show(redactions);
this._hide([...nonRedactionEntries, ...highlights]);
this._hide([...nonRedactionEntries]);
break;
}
case 'TEXT_HIGHLIGHTS': {

View File

@ -40,6 +40,7 @@ export class File extends Entity<IFile> implements IFile {
readonly hasSuggestions: boolean;
readonly processingStatus: ProcessingFileStatus;
readonly workflowStatus: WorkflowFileStatus;
readonly fileManipulationDate: string;
readonly statusSort: number;
readonly cacheIdentifier?: string;
@ -96,9 +97,10 @@ export class File extends Entity<IFile> implements IFile {
this.uploader = file.uploader;
this.excludedPages = file.excludedPages || [];
this.hasSuggestions = !!file.hasSuggestions;
this.fileManipulationDate = file.fileManipulationDate;
this.statusSort = StatusSorter[this.workflowStatus];
this.cacheIdentifier = btoa((this.lastUploaded ?? '') + (this.lastOCRTime ?? ''));
this.cacheIdentifier = btoa(this.fileManipulationDate ?? '');
this.hintsOnly = this.hasHints && !this.hasRedactions;
this.hasNone = !this.hasRedactions && !this.hasHints && !this.hasSuggestions;
this.isProcessing = isProcessingStatuses.includes(this.processingStatus);

View File

@ -147,4 +147,9 @@ export interface IFile {
readonly processingStatus: ProcessingFileStatus;
readonly workflowStatus: WorkflowFileStatus;
/**
* Last time the actual file was touched
*/
readonly fileManipulationDate: string;
}