From 0cfe3fce463b514e3d48448e17da90dcfbed1c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Fri, 25 Mar 2022 16:35:16 +0200 Subject: [PATCH 01/12] Viewer header config service updates --- .../pdf-viewer/pdf-viewer.component.ts | 22 ++- .../services/page-rotation.service.ts | 15 +- .../services/viewer-header-config.service.ts | 150 +++++++++--------- .../modules/file-preview/shared/constants.ts | 2 - 4 files changed, 99 insertions(+), 90 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/components/pdf-viewer/pdf-viewer.component.ts b/apps/red-ui/src/app/modules/file-preview/components/pdf-viewer/pdf-viewer.component.ts index e4950489e..c6c2e6cc2 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/pdf-viewer/pdf-viewer.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/pdf-viewer/pdf-viewer.component.ts @@ -11,7 +11,7 @@ import { SimpleChanges, ViewChild, } from '@angular/core'; -import { Dossier, File, IHeaderElement, IManualRedactionEntry } from '@red/domain'; +import { Dossier, File, IHeaderElement, IManualRedactionEntry, RotationType } from '@red/domain'; import { Core, WebViewerInstance } from '@pdftron/webviewer'; import { TranslateService } from '@ngx-translate/core'; import { @@ -353,8 +353,24 @@ export class PdfViewerComponent extends AutoUnsubscribe implements OnInit, OnCha const closeCompareFn = async () => { await this._closeCompareMode(); }; + const addRotation = (type: RotationType) => { + this._pageRotationService.addRotation(type); + }; + const applyRotation = async () => { + await this._pageRotationService.applyRotation(); + }; + const discardRotation = () => { + this._pageRotationService.discardRotation(); + }; - this._headerConfigService.initialize(toggleTooltipsFn, this.compareFileInput, closeCompareFn); + this._headerConfigService.initialize( + toggleTooltipsFn, + this.compareFileInput, + closeCompareFn, + addRotation, + applyRotation, + discardRotation, + ); const dossierTemplateId = this.dossier.dossierTemplateId; @@ -514,7 +530,6 @@ export class PdfViewerComponent extends AutoUnsubscribe implements OnInit, OnCha HeaderElements.SHAPE_TOOL_GROUP_BUTTON, HeaderElements.ROTATE_LEFT_BUTTON, HeaderElements.ROTATE_RIGHT_BUTTON, - HeaderElements.ANNOTATION_POPUP, ]; const isCurrentPageExcluded = this.pdf.isCurrentPageExcluded(await this.stateService.file); @@ -540,7 +555,6 @@ export class PdfViewerComponent extends AutoUnsubscribe implements OnInit, OnCha if (isCurrentPageExcluded) { const allowedActionsWhenPageExcluded: string[] = [ - HeaderElements.ANNOTATION_POPUP, TextPopups.ADD_RECTANGLE, TextPopups.ADD_REDACTION, HeaderElements.SHAPE_TOOL_GROUP_BUTTON, diff --git a/apps/red-ui/src/app/modules/file-preview/services/page-rotation.service.ts b/apps/red-ui/src/app/modules/file-preview/services/page-rotation.service.ts index 1ed4f7332..df276d163 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/page-rotation.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/page-rotation.service.ts @@ -16,9 +16,10 @@ import { } from '@iqser/common-ui'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { MatDialog } from '@angular/material/dialog'; +import { ViewerHeaderConfigService } from './viewer-header-config.service'; -const actionButtons = [HeaderElements.APPLY_ROTATION, HeaderElements.DISCARD_ROTATION]; -const oneRotationDegree = 90; +const ACTION_BUTTONS = [HeaderElements.APPLY_ROTATION, HeaderElements.DISCARD_ROTATION]; +const ONE_ROTATION_DEGREE = 90; @Injectable() export class PageRotationService { @@ -31,6 +32,7 @@ export class PageRotationService { private readonly _screenState: FilePreviewStateService, private readonly _permissionsService: PermissionsService, private readonly _fileManagementService: FileManagementService, + private readonly _headerConfigService: ViewerHeaderConfigService, ) {} isRotated(page: number) { @@ -58,7 +60,7 @@ export class PageRotationService { const rotations = this.#rotations$.value; for (const page of Object.keys(rotations)) { - const times = rotations[page] / oneRotationDegree; + const times = rotations[page] / ONE_ROTATION_DEGREE; for (let i = 1; i <= times; i++) { this._pdf?.documentViewer?.rotateCounterClockwise(Number(page)); } @@ -116,14 +118,11 @@ export class PageRotationService { return this.hasRotations() ? this.showConfirmationDialog() : of(ConfirmOptions.DISCARD_CHANGES); } - // TODO: Ideally, enabling/disabling buttons should be done through ViewerHeaderConfigService, not through _pdf.UI, - // but circular dependencies =D - #showActionButtons() { - this._pdf.UI.enableElements(actionButtons); + this._headerConfigService.enable(ACTION_BUTTONS); } #hideActionButtons() { - this._pdf.UI.disableElements(actionButtons); + this._headerConfigService.disable(ACTION_BUTTONS); } } diff --git a/apps/red-ui/src/app/modules/file-preview/services/viewer-header-config.service.ts b/apps/red-ui/src/app/modules/file-preview/services/viewer-header-config.service.ts index 9d62c4056..51a79e3bd 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/viewer-header-config.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/viewer-header-config.service.ts @@ -1,8 +1,7 @@ import { ElementRef, Inject, Injectable } from '@angular/core'; -import { IHeaderElement, RotationTypes } from '@red/domain'; +import { IHeaderElement, RotationType, RotationTypes } from '@red/domain'; import { HeaderElements, HeaderElementType } from '../shared/constants'; import { TranslateService } from '@ngx-translate/core'; -import { PageRotationService } from './page-rotation.service'; import { BASE_HREF } from '../../../tokens'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { UserPreferenceService } from '@services/user-preference.service'; @@ -16,68 +15,22 @@ export class ViewerHeaderConfigService { private _buttons: Map; private _config: Map = new Map([ [HeaderElements.SHAPE_TOOL_GROUP_BUTTON, true], - [HeaderElements.ROTATE_LEFT_BUTTON, true], - [HeaderElements.ROTATE_RIGHT_BUTTON, true], - [HeaderElements.APPLY_ROTATION, true], - [HeaderElements.DISCARD_ROTATION, true], [HeaderElements.TOGGLE_TOOLTIPS, true], - [HeaderElements.ANNOTATION_POPUP, true], [HeaderElements.COMPARE_BUTTON, true], [HeaderElements.CLOSE_COMPARE_BUTTON, false], + [HeaderElements.ROTATE_LEFT_BUTTON, true], + [HeaderElements.ROTATE_RIGHT_BUTTON, true], + [HeaderElements.APPLY_ROTATION, false], + [HeaderElements.DISCARD_ROTATION, false], ]); constructor( @Inject(BASE_HREF) private readonly _baseHref: string, private readonly _translateService: TranslateService, - private readonly _pageRotationService: PageRotationService, private readonly _userPreferenceService: UserPreferenceService, private readonly _pdfViewer: PdfViewer, ) {} - private get _applyRotation(): IHeaderElement { - return { - type: 'customElement', - dataElement: HeaderElements.APPLY_ROTATION, - render: () => { - const paragraph = document.createElement('p'); - paragraph.innerText = this._translateService.instant('page-rotation.apply'); - paragraph.style.cssText = ` - font-size: 11px; - font-weight: 600; - color: #DD4D50; - cursor: pointer; - margin: 0 12px; - `; - paragraph.addEventListener('click', async () => { - await this._pageRotationService.applyRotation(); - }); - return paragraph; - }, - }; - } - - private get _discardRotation(): IHeaderElement { - return { - type: 'customElement', - dataElement: HeaderElements.DISCARD_ROTATION, - render: () => { - const paragraph = document.createElement('p'); - paragraph.innerText = this._translateService.instant('page-rotation.discard'); - paragraph.style.cssText = ` - font-size: 11px; - font-weight: 600; - color: #283241; - cursor: pointer; - opacity: 0.7; - `; - paragraph.addEventListener('click', () => { - this._pageRotationService.discardRotation(); - }); - return paragraph; - }, - }; - } - private get _rectangle(): IHeaderElement { return { type: 'toolGroupButton', @@ -88,26 +41,6 @@ export class ViewerHeaderConfigService { }; } - private get _rotateLeft(): IHeaderElement { - return { - type: 'actionButton', - element: 'tooltips', - dataElement: HeaderElements.ROTATE_LEFT_BUTTON, - img: this._convertPath('/assets/icons/general/rotate-left.svg'), - onClick: () => this._pageRotationService.addRotation(RotationTypes.LEFT), - }; - } - - private get _rotateRight(): IHeaderElement { - return { - type: 'actionButton', - element: 'tooltips', - dataElement: HeaderElements.ROTATE_RIGHT_BUTTON, - img: this._convertPath('/assets/icons/general/rotate-right.svg'), - onClick: () => this._pageRotationService.addRotation(RotationTypes.RIGHT), - }; - } - private get _toggleTooltipsBtnTitle(): string { return this._translateService.instant(_('pdf-viewer.toggle-tooltips'), { active: this._userPreferenceService.getFilePreviewTooltipsPreference(), @@ -126,6 +59,9 @@ export class ViewerHeaderConfigService { toggleTooltips: (title: string, img: string) => Promise, compareFileInput: ElementRef, closeCompareMode: () => Promise, + addRotation: (type: RotationType) => void, + applyRotation: () => Promise, + discardRotation: () => void, ): void { if (this._buttons) { console.error('ERROR: ViewerHeaderConfigService can only be initialized once!'); @@ -134,10 +70,10 @@ export class ViewerHeaderConfigService { this._buttons = new Map([ [HeaderElements.SHAPE_TOOL_GROUP_BUTTON, this._rectangle], - [HeaderElements.ROTATE_LEFT_BUTTON, this._rotateLeft], - [HeaderElements.ROTATE_RIGHT_BUTTON, this._rotateRight], - [HeaderElements.APPLY_ROTATION, this._applyRotation], - [HeaderElements.DISCARD_ROTATION, this._discardRotation], + [HeaderElements.ROTATE_LEFT_BUTTON, this._rotateLeft(addRotation)], + [HeaderElements.ROTATE_RIGHT_BUTTON, this._rotateRight(addRotation)], + [HeaderElements.APPLY_ROTATION, this._applyRotation(applyRotation)], + [HeaderElements.DISCARD_ROTATION, this._discardRotation(discardRotation)], [HeaderElements.TOGGLE_TOOLTIPS, this._toggleTooltips(toggleTooltips)], [HeaderElements.COMPARE_BUTTON, this._compare(compareFileInput)], [HeaderElements.CLOSE_COMPARE_BUTTON, this._closeCompare(closeCompareMode)], @@ -154,6 +90,68 @@ export class ViewerHeaderConfigService { this._updateState(elements, false); } + private _applyRotation(applyRotation: () => Promise): IHeaderElement { + return { + type: 'customElement', + dataElement: HeaderElements.APPLY_ROTATION, + render: () => { + const paragraph = document.createElement('p'); + paragraph.innerText = this._translateService.instant('page-rotation.apply'); + paragraph.style.cssText = ` + font-size: 11px; + font-weight: 600; + color: #DD4D50; + cursor: pointer; + margin: 0 12px; + `; + paragraph.addEventListener('click', async () => { + await applyRotation(); + }); + return paragraph; + }, + }; + } + + private _discardRotation(discardRotation: () => void): IHeaderElement { + return { + type: 'customElement', + dataElement: HeaderElements.DISCARD_ROTATION, + render: () => { + const paragraph = document.createElement('p'); + paragraph.innerText = this._translateService.instant('page-rotation.discard'); + paragraph.style.cssText = ` + font-size: 11px; + font-weight: 600; + color: #283241; + cursor: pointer; + opacity: 0.7; + `; + paragraph.addEventListener('click', () => discardRotation()); + return paragraph; + }, + }; + } + + private _rotateLeft(addRotation: (type: RotationType) => void): IHeaderElement { + return { + type: 'actionButton', + element: 'tooltips', + dataElement: HeaderElements.ROTATE_LEFT_BUTTON, + img: this._convertPath('/assets/icons/general/rotate-left.svg'), + onClick: () => addRotation(RotationTypes.LEFT), + }; + } + + private _rotateRight(addRotation: (type: RotationType) => void): IHeaderElement { + return { + type: 'actionButton', + element: 'tooltips', + dataElement: HeaderElements.ROTATE_RIGHT_BUTTON, + img: this._convertPath('/assets/icons/general/rotate-right.svg'), + onClick: () => addRotation(RotationTypes.RIGHT), + }; + } + private _toggleTooltips(toggleTooltips: (title: string, img: string) => Promise): IHeaderElement { return { type: 'actionButton', diff --git a/apps/red-ui/src/app/modules/file-preview/shared/constants.ts b/apps/red-ui/src/app/modules/file-preview/shared/constants.ts index 2826adb84..75e87885e 100644 --- a/apps/red-ui/src/app/modules/file-preview/shared/constants.ts +++ b/apps/red-ui/src/app/modules/file-preview/shared/constants.ts @@ -9,7 +9,6 @@ export type HeaderElementType = | 'APPLY_ROTATION' | 'DISCARD_ROTATION' | 'TOGGLE_TOOLTIPS' - | 'ANNOTATION_POPUP' | 'COMPARE_BUTTON' | 'CLOSE_COMPARE_BUTTON'; @@ -20,7 +19,6 @@ export const HeaderElements: Record = { APPLY_ROTATION: 'APPLY_ROTATION', DISCARD_ROTATION: 'DISCARD_ROTATION', TOGGLE_TOOLTIPS: 'TOGGLE_TOOLTIPS', - ANNOTATION_POPUP: 'ANNOTATION_POPUP', COMPARE_BUTTON: 'COMPARE_BUTTON', CLOSE_COMPARE_BUTTON: 'CLOSE_COMPARE_BUTTON', } as const; From f8922bfbdb56f06423e0afe6d4ec5ba9634fee1d Mon Sep 17 00:00:00 2001 From: Atlassian Bamboo Date: Fri, 25 Mar 2022 15:40:09 +0100 Subject: [PATCH 02/12] chore(release) --- package.json | 2 +- paligo-theme.tar.gz | Bin 3215 -> 3215 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 58575021c..0395a1d50 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "redaction", - "version": "3.370.0", + "version": "3.371.0", "private": true, "license": "MIT", "scripts": { diff --git a/paligo-theme.tar.gz b/paligo-theme.tar.gz index 0b3485dcba45a55a5e9f88d0611489a11c13d67b..142b64f43ffceaadaa6583d87786228079d908a4 100644 GIT binary patch delta 103 zcmV-t0GR)e8IKu|cT)?TAaGvUjvd&+D-`@7)C^ivGh89`V=VP^Y;#@z@<+{{GE#qE z)^NK1J=zkG-i?PbR3kWeo JrBVP;000VeFuni) delta 103 zcmV-t0GR)e8IKu|cT@2LCs@9+9XoLBS19;Fs2Q}TX1GG=$5`s;*yg(a<&T;@Wu*ST ztl@P1d!Fr|_5WkEz51_6j3Xw;=22aL*cx2H3x7)go&)Oc_3tk|(ElRv-LcBO3kbK0 Jm^lDY005|hIP?Gj From d9478d25ff6bc31cde5d1977ef113ac64c639b13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Fri, 25 Mar 2022 17:02:26 +0200 Subject: [PATCH 03/12] Tooltips service --- .../pdf-viewer/pdf-viewer.component.ts | 27 ++-------- .../file-preview/file-preview-providers.ts | 2 + .../file-preview/services/tooltips.service.ts | 49 +++++++++++++++++ .../services/viewer-header-config.service.ts | 52 +++++++------------ 4 files changed, 73 insertions(+), 57 deletions(-) create mode 100644 apps/red-ui/src/app/modules/file-preview/services/tooltips.service.ts diff --git a/apps/red-ui/src/app/modules/file-preview/components/pdf-viewer/pdf-viewer.component.ts b/apps/red-ui/src/app/modules/file-preview/components/pdf-viewer/pdf-viewer.component.ts index c6c2e6cc2..b28008e9f 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/pdf-viewer/pdf-viewer.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/pdf-viewer/pdf-viewer.component.ts @@ -44,6 +44,7 @@ import { loadCompareDocumentWrapper } from '../../../dossier/utils/compare-mode. import { from, fromEvent } from 'rxjs'; import { FileDataService } from '../../services/file-data.service'; import { ViewerHeaderConfigService } from '../../services/viewer-header-config.service'; +import { TooltipsService } from '../../services/tooltips.service'; import Tools = Core.Tools; import TextTool = Tools.TextTool; import Annotation = Core.Annotations.Annotation; @@ -84,6 +85,7 @@ export class PdfViewerComponent extends AutoUnsubscribe implements OnInit, OnCha private readonly _pageRotationService: PageRotationService, private readonly _fileDataService: FileDataService, private readonly _headerConfigService: ViewerHeaderConfigService, + private readonly _tooltipsService: TooltipsService, readonly stateService: FilePreviewStateService, readonly viewModeService: ViewModeService, readonly multiSelectService: MultiSelectService, @@ -317,12 +319,6 @@ export class PdfViewerComponent extends AutoUnsubscribe implements OnInit, OnCha } } - private async _toggleTooltips(title: string, img: string): Promise { - await this._userPreferenceService.toggleFilePreviewTooltipsPreference(); - this._updateTooltipsVisibility(); - this.instance.UI.updateElement(HeaderElements.TOGGLE_TOOLTIPS, { title, img }); - } - private _configureElements() { this.instance.UI.disableElements([ 'pageNavOverlay', @@ -347,9 +343,6 @@ export class PdfViewerComponent extends AutoUnsubscribe implements OnInit, OnCha 'annotationGroupButton', ]); - const toggleTooltipsFn = async (title: string, img: string) => { - await this._toggleTooltips(title, img); - }; const closeCompareFn = async () => { await this._closeCompareMode(); }; @@ -363,14 +356,7 @@ export class PdfViewerComponent extends AutoUnsubscribe implements OnInit, OnCha this._pageRotationService.discardRotation(); }; - this._headerConfigService.initialize( - toggleTooltipsFn, - this.compareFileInput, - closeCompareFn, - addRotation, - applyRotation, - discardRotation, - ); + this._headerConfigService.initialize(this.compareFileInput, closeCompareFn, addRotation, applyRotation, discardRotation); const dossierTemplateId = this.dossier.dossierTemplateId; @@ -600,12 +586,7 @@ export class PdfViewerComponent extends AutoUnsubscribe implements OnInit, OnCha const routePageNumber: number = this._activatedRoute.snapshot.queryParams.page; this.pageChanged.emit(routePageNumber || 1); this._setInitialDisplayMode(); - this._updateTooltipsVisibility(); + this._tooltipsService.updateTooltipsVisibility(); }); } - - private _updateTooltipsVisibility(): void { - const current = this._userPreferenceService.getFilePreviewTooltipsPreference(); - this.instance.UI.setAnnotationContentOverlayHandler(() => (current ? undefined : false)); - } } diff --git a/apps/red-ui/src/app/modules/file-preview/file-preview-providers.ts b/apps/red-ui/src/app/modules/file-preview/file-preview-providers.ts index cc630ae8a..c89b22949 100644 --- a/apps/red-ui/src/app/modules/file-preview/file-preview-providers.ts +++ b/apps/red-ui/src/app/modules/file-preview/file-preview-providers.ts @@ -15,6 +15,7 @@ import { PageRotationService } from './services/page-rotation.service'; import { PdfViewer } from './services/pdf-viewer.service'; import { FileDataService } from './services/file-data.service'; import { ViewerHeaderConfigService } from './services/viewer-header-config.service'; +import { TooltipsService } from './services/tooltips.service'; export const filePreviewScreenProviders = [ FilterService, @@ -34,4 +35,5 @@ export const filePreviewScreenProviders = [ FileDataService, dossiersServiceProvider, ViewerHeaderConfigService, + TooltipsService, ]; diff --git a/apps/red-ui/src/app/modules/file-preview/services/tooltips.service.ts b/apps/red-ui/src/app/modules/file-preview/services/tooltips.service.ts new file mode 100644 index 000000000..a99304094 --- /dev/null +++ b/apps/red-ui/src/app/modules/file-preview/services/tooltips.service.ts @@ -0,0 +1,49 @@ +import { Inject, Injectable } from '@angular/core'; +import { PdfViewer } from './pdf-viewer.service'; +import { UserPreferenceService } from '@services/user-preference.service'; +import { HeaderElements } from '../shared/constants'; +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; +import { TranslateService } from '@ngx-translate/core'; +import { BASE_HREF } from '../../../tokens'; + +@Injectable() +export class TooltipsService { + constructor( + @Inject(BASE_HREF) private readonly _baseHref: string, + private readonly _pdfViewer: PdfViewer, + private readonly _userPreferenceService: UserPreferenceService, + private readonly _translateService: TranslateService, + ) {} + + get toggleTooltipsBtnTitle(): string { + return this._translateService.instant(_('pdf-viewer.toggle-tooltips'), { + active: this._userPreferenceService.getFilePreviewTooltipsPreference(), + }); + } + + get toggleTooltipsBtnIcon(): string { + return this._convertPath( + this._userPreferenceService.getFilePreviewTooltipsPreference() + ? '/assets/icons/general/pdftron-action-enable-tooltips.svg' + : '/assets/icons/general/pdftron-action-disable-tooltips.svg', + ); + } + + updateTooltipsVisibility(): void { + const current = this._userPreferenceService.getFilePreviewTooltipsPreference(); + this._pdfViewer.instance.UI.setAnnotationContentOverlayHandler(() => (current ? undefined : false)); + } + + async toggleTooltips(): Promise { + await this._userPreferenceService.toggleFilePreviewTooltipsPreference(); + this.updateTooltipsVisibility(); + this._pdfViewer.instance.UI.updateElement(HeaderElements.TOGGLE_TOOLTIPS, { + title: this.toggleTooltipsBtnTitle, + img: this.toggleTooltipsBtnIcon, + }); + } + + private _convertPath(path: string): string { + return this._baseHref + path; + } +} diff --git a/apps/red-ui/src/app/modules/file-preview/services/viewer-header-config.service.ts b/apps/red-ui/src/app/modules/file-preview/services/viewer-header-config.service.ts index 51a79e3bd..422f6b9e8 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/viewer-header-config.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/viewer-header-config.service.ts @@ -3,9 +3,8 @@ import { IHeaderElement, RotationType, RotationTypes } from '@red/domain'; import { HeaderElements, HeaderElementType } from '../shared/constants'; import { TranslateService } from '@ngx-translate/core'; import { BASE_HREF } from '../../../tokens'; -import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; -import { UserPreferenceService } from '@services/user-preference.service'; import { PdfViewer } from './pdf-viewer.service'; +import { TooltipsService } from './tooltips.service'; @Injectable() export class ViewerHeaderConfigService { @@ -27,8 +26,8 @@ export class ViewerHeaderConfigService { constructor( @Inject(BASE_HREF) private readonly _baseHref: string, private readonly _translateService: TranslateService, - private readonly _userPreferenceService: UserPreferenceService, private readonly _pdfViewer: PdfViewer, + private readonly _tooltipsService: TooltipsService, ) {} private get _rectangle(): IHeaderElement { @@ -41,22 +40,20 @@ export class ViewerHeaderConfigService { }; } - private get _toggleTooltipsBtnTitle(): string { - return this._translateService.instant(_('pdf-viewer.toggle-tooltips'), { - active: this._userPreferenceService.getFilePreviewTooltipsPreference(), - }); - } - - private get _toggleTooltipsBtnIcon(): string { - return this._convertPath( - this._userPreferenceService.getFilePreviewTooltipsPreference() - ? '/assets/icons/general/pdftron-action-enable-tooltips.svg' - : '/assets/icons/general/pdftron-action-disable-tooltips.svg', - ); + private get _toggleTooltips(): IHeaderElement { + return { + type: 'actionButton', + element: HeaderElements.TOGGLE_TOOLTIPS, + dataElement: HeaderElements.TOGGLE_TOOLTIPS, + title: this._tooltipsService.toggleTooltipsBtnTitle, + img: this._tooltipsService.toggleTooltipsBtnIcon, + onClick: async () => { + await this._tooltipsService.toggleTooltips(); + }, + }; } initialize( - toggleTooltips: (title: string, img: string) => Promise, compareFileInput: ElementRef, closeCompareMode: () => Promise, addRotation: (type: RotationType) => void, @@ -74,7 +71,7 @@ export class ViewerHeaderConfigService { [HeaderElements.ROTATE_RIGHT_BUTTON, this._rotateRight(addRotation)], [HeaderElements.APPLY_ROTATION, this._applyRotation(applyRotation)], [HeaderElements.DISCARD_ROTATION, this._discardRotation(discardRotation)], - [HeaderElements.TOGGLE_TOOLTIPS, this._toggleTooltips(toggleTooltips)], + [HeaderElements.TOGGLE_TOOLTIPS, this._toggleTooltips], [HeaderElements.COMPARE_BUTTON, this._compare(compareFileInput)], [HeaderElements.CLOSE_COMPARE_BUTTON, this._closeCompare(closeCompareMode)], ]); @@ -135,7 +132,7 @@ export class ViewerHeaderConfigService { private _rotateLeft(addRotation: (type: RotationType) => void): IHeaderElement { return { type: 'actionButton', - element: 'tooltips', + element: HeaderElements.ROTATE_LEFT_BUTTON, dataElement: HeaderElements.ROTATE_LEFT_BUTTON, img: this._convertPath('/assets/icons/general/rotate-left.svg'), onClick: () => addRotation(RotationTypes.LEFT), @@ -145,30 +142,17 @@ export class ViewerHeaderConfigService { private _rotateRight(addRotation: (type: RotationType) => void): IHeaderElement { return { type: 'actionButton', - element: 'tooltips', + element: HeaderElements.ROTATE_RIGHT_BUTTON, dataElement: HeaderElements.ROTATE_RIGHT_BUTTON, img: this._convertPath('/assets/icons/general/rotate-right.svg'), onClick: () => addRotation(RotationTypes.RIGHT), }; } - private _toggleTooltips(toggleTooltips: (title: string, img: string) => Promise): IHeaderElement { - return { - type: 'actionButton', - element: 'tooltips', - dataElement: HeaderElements.TOGGLE_TOOLTIPS, - img: this._toggleTooltipsBtnIcon, - title: this._toggleTooltipsBtnTitle, - onClick: async () => { - await toggleTooltips(this._toggleTooltipsBtnTitle, this._toggleTooltipsBtnIcon); - }, - }; - } - private _closeCompare(closeCompareMode: () => Promise): IHeaderElement { return { type: 'actionButton', - element: 'closeCompare', + element: HeaderElements.CLOSE_COMPARE_BUTTON, dataElement: HeaderElements.CLOSE_COMPARE_BUTTON, img: this._convertPath('/assets/icons/general/pdftron-action-close-compare.svg'), title: 'Leave Compare Mode', @@ -181,7 +165,7 @@ export class ViewerHeaderConfigService { private _compare(compareFileInput: ElementRef): IHeaderElement { return { type: 'actionButton', - element: 'compare', + element: HeaderElements.COMPARE_BUTTON, dataElement: HeaderElements.COMPARE_BUTTON, img: this._convertPath('/assets/icons/general/pdftron-action-compare.svg'), title: 'Compare', From 285a8b8fed25df08978d7742d8f0251eef3b699c Mon Sep 17 00:00:00 2001 From: Atlassian Bamboo Date: Fri, 25 Mar 2022 16:07:02 +0100 Subject: [PATCH 04/12] chore(release) --- package.json | 2 +- paligo-theme.tar.gz | Bin 3215 -> 3216 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0395a1d50..064d18dfe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "redaction", - "version": "3.371.0", + "version": "3.372.0", "private": true, "license": "MIT", "scripts": { diff --git a/paligo-theme.tar.gz b/paligo-theme.tar.gz index 142b64f43ffceaadaa6583d87786228079d908a4..df53292bb65809783895621160b4401021c1f4f5 100644 GIT binary patch delta 3127 zcmV-749N438IT!}cz^uG!g*yocHp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=)nB%wBXgg|Y$3iYMnmLDY8h?T7&+oO&z6Enyl1J&jqojlf zxl=MUsr3Vd?7xNZ9543C1QIBr>01IB%aE@RMx>v0$vQ*Jh57xd5y@+Qq}5^QWSEge z&BUgFnrt6UCZje7EE zdk@G<&O)crs?y3KwojE%TM#3{6{C?X3C9;i!;0WS9%ccg%ds|Hvo_swgvB76-DGUR2WAD)~>ZB!{~WU{pUA9NL#m(_Cq@{V9R1 zm=J%U2HN4ZaQnnSjbAcEL^zACpoB*jav)q>s|=vjlf<{*dcxbElIZpa*G%e-jvDlh zFzJ7dXB{Jzu5|gLvZJolh$|J^N=aI4Hh=me6Cp|UU#0F`+}`KS#o?{t$;qT$47cKQ zhok)fCgZ2Uio2YxOBsw1YmmW}yk{yBi#?U(dYnb}N0Z`GtO)-JOio`us*^e&yYGOu zb4N;k00kM}Yg{N`SncV9Z_gkVn4v|$j~*QVdbAj5uGEBYaHMAAR*!r6!#Wxb$bSvv|Uw&~w7e1(gfag9UZ`2Y;uq zmlzR@50EpNx*fpW2f;)5U-AY)#eKxn19kf3ivxYqaSsg!Fh{;G7?AVgX9YuiFUg>F z?RJj{27K;)J8+61`vUzWLH7Q*tbdA##9)1*M4Q))lm}kjPNaB_DMcB}P8WZF4)IMx z>i&(Ku|n!+yhbb@1xIoJWs5k24D&}4>}py0ys~$r34P@IP!^rCh-pJKS~FOTupaaN z*JUC;ns?@&dsE4L`&N66F8OP1#9wP)&QJ{>R!u4@{O(VDEGpPbof#5e=6~=_cDa3* z+jV(;m)CXqeV5;L1$|f0buId?h3qQ3&x(v))^Vb1X+QEXc4F#jXRwniFN zJMp>u^H_O9jNLQagBSx1qoVsEM( Date: Fri, 25 Mar 2022 17:21:28 +0200 Subject: [PATCH 05/12] Remove viewer header config service init params --- .../pdf-viewer/pdf-viewer.component.html | 14 +- .../pdf-viewer/pdf-viewer.component.ts | 67 +++------ .../services/pdf-viewer.service.ts | 4 +- .../services/viewer-header-config.service.ts | 133 ++++++++++-------- 4 files changed, 102 insertions(+), 116 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/components/pdf-viewer/pdf-viewer.component.html b/apps/red-ui/src/app/modules/file-preview/components/pdf-viewer/pdf-viewer.component.html index c670ce353..083b15513 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/pdf-viewer/pdf-viewer.component.html +++ b/apps/red-ui/src/app/modules/file-preview/components/pdf-viewer/pdf-viewer.component.html @@ -4,16 +4,16 @@ -