RED-5889: Changed keyboard shortcuts for document viewer search.
This commit is contained in:
parent
ecdefa62d7
commit
0319339671
@ -360,7 +360,9 @@ export class FilePreviewScreenComponent
|
||||
if (['Escape'].includes($event.key)) {
|
||||
this.fullScreen = false;
|
||||
this.closeFullScreen();
|
||||
this.pdf.deactivateSearch();
|
||||
this._changeRef.markForCheck();
|
||||
window.focus();
|
||||
}
|
||||
|
||||
if (['f', 'F'].includes($event.key)) {
|
||||
@ -368,6 +370,12 @@ 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;
|
||||
}
|
||||
|
||||
@ -58,8 +58,21 @@ export class REDDocumentViewer {
|
||||
get #keyUp$() {
|
||||
return fromEvent<KeyboardEvent>(this.#document, 'keyUp').pipe(
|
||||
tap(stopAndPreventIfNotAllowed),
|
||||
filter($event => ($event.target as HTMLElement)?.tagName?.toLowerCase() !== 'input'),
|
||||
filter($event => $event.key.startsWith('Arrow') || $event.key === 'f' || ['h', 'H'].includes($event.key)),
|
||||
filter($event => {
|
||||
if (($event.target as HTMLElement)?.tagName?.toLowerCase() === 'input') {
|
||||
if ($event.key === 'Escape') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
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),
|
||||
),
|
||||
tap<KeyboardEvent>(stopAndPrevent),
|
||||
log('[PDF] Keyboard shortcut'),
|
||||
);
|
||||
|
||||
@ -106,6 +106,21 @@ export class PdfViewer {
|
||||
return page$.pipe(map(page => this.#adjustPage(page)));
|
||||
}
|
||||
|
||||
focusSearch() {
|
||||
const iframeWindow = this.#instance.UI.iframeWindow;
|
||||
const input = iframeWindow.document.getElementById('SearchPanel__input') as HTMLInputElement;
|
||||
input.focus();
|
||||
input.select();
|
||||
}
|
||||
|
||||
activateSearch() {
|
||||
this.#instance.UI.openElements(['searchPanel']);
|
||||
}
|
||||
|
||||
deactivateSearch() {
|
||||
this.#instance.UI.closeElements(['searchPanel']);
|
||||
}
|
||||
|
||||
resetAnnotationActions() {
|
||||
if (this.#instance.UI.annotationPopup.getItems().length) {
|
||||
this.#instance.UI.annotationPopup.update([]);
|
||||
|
||||
@ -67,6 +67,7 @@ export const DISABLED_HOTKEYS = [
|
||||
'COMMAND+O',
|
||||
'CTRL+P',
|
||||
'COMMAND+P',
|
||||
'CTRL+F',
|
||||
'SPACE',
|
||||
'UP',
|
||||
'DOWN',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user