RED-10592: fixed listener to esc key in pdf viewer.
This commit is contained in:
parent
036b921977
commit
df0e89589e
@ -4,7 +4,6 @@ import {
|
|||||||
Component,
|
Component,
|
||||||
computed,
|
computed,
|
||||||
ElementRef,
|
ElementRef,
|
||||||
HostListener,
|
|
||||||
Input,
|
Input,
|
||||||
NgZone,
|
NgZone,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
|
|||||||
@ -300,7 +300,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
|||||||
super.ngOnDestroy();
|
super.ngOnDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bind()
|
|
||||||
handleEscInsideViewer($event: KeyboardEvent) {
|
handleEscInsideViewer($event: KeyboardEvent) {
|
||||||
$event.preventDefault();
|
$event.preventDefault();
|
||||||
if (!!this._annotationManager.selected[0]) {
|
if (!!this._annotationManager.selected[0]) {
|
||||||
@ -374,7 +373,13 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
|||||||
|
|
||||||
this.pdfProxyService.configureElements();
|
this.pdfProxyService.configureElements();
|
||||||
this.#restoreOldFilters();
|
this.#restoreOldFilters();
|
||||||
this.pdf.instance.UI.hotkeys.on('esc', this.handleEscInsideViewer);
|
this.pdf.instance.UI.hotkeys.on('esc', {
|
||||||
|
keydown: (e: KeyboardEvent) => this.pdf.escKeyHandler.keydown(e),
|
||||||
|
keyup: (e: KeyboardEvent) => {
|
||||||
|
this.pdf.escKeyHandler.keyup(e);
|
||||||
|
this.handleEscInsideViewer(e);
|
||||||
|
},
|
||||||
|
});
|
||||||
this._viewerHeaderService.resetLayers();
|
this._viewerHeaderService.resetLayers();
|
||||||
this.pdf.instance.UI.iframeWindow.document.removeEventListener('click', this.handleViewerClick);
|
this.pdf.instance.UI.iframeWindow.document.removeEventListener('click', this.handleViewerClick);
|
||||||
this.pdf.instance.UI.iframeWindow.document.addEventListener('click', this.handleViewerClick);
|
this.pdf.instance.UI.iframeWindow.document.addEventListener('click', this.handleViewerClick);
|
||||||
|
|||||||
@ -65,6 +65,21 @@ export class PdfViewer {
|
|||||||
};
|
};
|
||||||
selectedText = '';
|
selectedText = '';
|
||||||
|
|
||||||
|
readonly escKeyHandler = {
|
||||||
|
keydown: (e: KeyboardEvent) => {
|
||||||
|
e.preventDefault();
|
||||||
|
this.#clickSelectToolButton();
|
||||||
|
},
|
||||||
|
keyup: (e: KeyboardEvent) => {
|
||||||
|
e.preventDefault();
|
||||||
|
if (this.#isElementActive('searchPanel') && !this._annotationManager.resizingAnnotationId) {
|
||||||
|
this.#focusViewer();
|
||||||
|
this.deactivateSearch();
|
||||||
|
}
|
||||||
|
this.#clickSelectToolButton();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _logger: NGXLogger,
|
private readonly _logger: NGXLogger,
|
||||||
private readonly _errorService: ErrorService,
|
private readonly _errorService: ErrorService,
|
||||||
@ -168,7 +183,6 @@ export class PdfViewer {
|
|||||||
this.#disableHotkeys();
|
this.#disableHotkeys();
|
||||||
this.#getSelectedText();
|
this.#getSelectedText();
|
||||||
this.#listenForCommandF();
|
this.#listenForCommandF();
|
||||||
this.#listenForEsc();
|
|
||||||
this.#listenForShift();
|
this.#listenForShift();
|
||||||
this.#clearSearchResultsWhenVisibilityChanged();
|
this.#clearSearchResultsWhenVisibilityChanged();
|
||||||
});
|
});
|
||||||
@ -276,23 +290,6 @@ export class PdfViewer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#listenForEsc() {
|
|
||||||
this.#instance.UI.hotkeys.on('esc', {
|
|
||||||
keydown: (e: KeyboardEvent) => {
|
|
||||||
e.preventDefault();
|
|
||||||
this.#clickSelectToolButton();
|
|
||||||
},
|
|
||||||
keyup: (e: KeyboardEvent) => {
|
|
||||||
e.preventDefault();
|
|
||||||
if (this.#isElementActive('searchPanel') && !this._annotationManager.resizingAnnotationId) {
|
|
||||||
this.#focusViewer();
|
|
||||||
this.deactivateSearch();
|
|
||||||
}
|
|
||||||
this.#clickSelectToolButton();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
#listenForShift() {
|
#listenForShift() {
|
||||||
this.#instance.UI.iframeWindow.addEventListener('keydown', e => {
|
this.#instance.UI.iframeWindow.addEventListener('keydown', e => {
|
||||||
if (e.target === this.#searchInput) return;
|
if (e.target === this.#searchInput) return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user