RED-5889: Fixed ctrl+f and command+f not opening pdf search & cleanup.

This commit is contained in:
Nicoleta Panaghiu 2023-03-13 16:00:23 +02:00
parent 2db9fe67f4
commit 359fe585ee
3 changed files with 8 additions and 14 deletions

View File

@ -140,6 +140,12 @@ export class FilePreviewScreenComponent
this.fullScreen = false;
}
});
this.pdf.instance.UI.hotkeys.on('command+f, ctrl+f', e => {
e.preventDefault();
this.pdf.focusSearch();
this.pdf.activateSearch();
});
}
get changed() {
@ -360,7 +366,6 @@ export class FilePreviewScreenComponent
this.closeFullScreen();
this.pdf.deactivateSearch();
this._changeRef.markForCheck();
window.focus();
}
if (['f', 'F'].includes($event.key)) {
@ -368,12 +373,6 @@ export class FilePreviewScreenComponent
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

@ -67,13 +67,7 @@ export class REDDocumentViewer {
}
return ($event.target as HTMLElement)?.tagName?.toLowerCase() !== 'input';
}),
filter(
$event =>
$event.key.startsWith('Arrow') ||
$event.key === 'f' ||
['h', 'H'].includes($event.key) ||
['Escape'].includes($event.key),
),
filter($event => $event.key.startsWith('Arrow') || ['f', 'h', 'H', 'Escape'].includes($event.key)),
tap<KeyboardEvent>(stopAndPrevent),
log('[PDF] Keyboard shortcut'),
);

View File

@ -68,6 +68,7 @@ export const DISABLED_HOTKEYS = [
'CTRL+P',
'COMMAND+P',
'CTRL+F',
'COMMAND+F',
'SPACE',
'UP',
'DOWN',