RED-10563: fixed pdf search input.

This commit is contained in:
Nicoleta Panaghiu 2024-11-28 16:23:01 +02:00
parent 5c8c191151
commit bfb418fdfd

View File

@ -115,6 +115,11 @@ export class PdfViewer {
return page$.pipe(map(page => this.#adjustPage(page)));
}
get #searchInput() {
const iframeWindow = this.#instance.UI.iframeWindow;
return iframeWindow.document.getElementById('SearchPanel__input') as HTMLInputElement;
}
activateSearch() {
this.#instance.UI.searchTextFull('', this.searchOptions);
}
@ -292,13 +297,13 @@ export class PdfViewer {
#listenForShift() {
this.#instance.UI.iframeWindow.addEventListener('keydown', e => {
e.preventDefault();
if (e.target === this.#searchInput) return;
if (e.key === 'Shift') {
this.#setSelectionMode(SelectionModes.RECTANGULAR);
}
});
this.#instance.UI.iframeWindow.addEventListener('keyup', e => {
e.preventDefault();
if (e.target === this.#searchInput) return;
if (e.key === 'Shift') {
this.#setSelectionMode(SelectionModes.STRUCTURAL);
}
@ -395,13 +400,11 @@ export class PdfViewer {
if (this.#isElementActive('textPopup')) {
this.#instance.UI.closeElements(['textPopup']);
}
const iframeWindow = this.#instance.UI.iframeWindow;
const input = iframeWindow.document.getElementById('SearchPanel__input') as HTMLInputElement;
if (input) {
input.focus();
if (this.#searchInput) {
this.#searchInput.focus();
}
if (input?.value?.length > 0) {
input.select();
if (this.#searchInput?.value?.length > 0) {
this.#searchInput.select();
}
}