RED-7605: Fixed ctrl+f and f not working properly.

This commit is contained in:
Nicoleta Panaghiu 2023-09-19 12:11:57 +03:00
parent 7336cafeac
commit 44515e9f23
4 changed files with 17 additions and 9 deletions

View File

@ -365,16 +365,11 @@ export class FilePreviewScreenComponent
window.focus();
}
if (['f', 'F'].includes($event.key)) {
if (['f', 'F'].includes($event.key) && !$event.ctrlKey) {
// if you type in an input, don't toggle full-screen
if ($event.target instanceof HTMLInputElement || $event.target instanceof HTMLTextAreaElement) {
return;
}
if ($event.ctrlKey) {
this.pdf.focusSearch();
this.pdf.activateSearch();
return;
}
this.toggleFullScreen();
return;

View File

@ -105,8 +105,10 @@ export class PdfViewer {
focusSearch() {
const iframeWindow = this.#instance.UI.iframeWindow;
const input = iframeWindow.document.getElementById('SearchPanel__input') as HTMLInputElement;
input.focus();
input.select();
if (input) {
input.focus();
input.select();
}
}
activateSearch() {
@ -166,6 +168,7 @@ export class PdfViewer {
this.#configureElements();
this.#disableHotkeys();
this.#clearSearchResultsWhenVisibilityChanged();
this.#listenForCommandF();
return this.#instance;
}
@ -275,6 +278,14 @@ export class PdfViewer {
});
}
#listenForCommandF() {
this.#instance.UI.hotkeys.on('command+f, ctrl+f', e => {
e.preventDefault();
this.activateSearch();
this.focusSearch();
});
}
#navigateTo(pageNumber: number) {
if (this.#currentInternalPage !== pageNumber) {
this.documentViewer.displayPageLocation(pageNumber, 0, 0);

View File

@ -68,6 +68,7 @@ export const DISABLED_HOTKEYS = [
'CTRL+P',
'COMMAND+P',
'CTRL+F',
'COMMAND+F',
'SPACE',
'UP',
'DOWN',
@ -77,6 +78,7 @@ export const DISABLED_HOTKEYS = [
'C',
'E',
'I',
'F',
'L',
'N',
'O',

@ -1 +1 @@
Subproject commit 57375e24898d1fec8939f44e2f19a04eb3da08f7
Subproject commit ac3ccb1d7dda79fa196269d3f0565bbcf5d9067d