RED-10563: fixed pdf search input.
This commit is contained in:
parent
5c8c191151
commit
bfb418fdfd
@ -115,6 +115,11 @@ export class PdfViewer {
|
|||||||
return page$.pipe(map(page => this.#adjustPage(page)));
|
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() {
|
activateSearch() {
|
||||||
this.#instance.UI.searchTextFull('', this.searchOptions);
|
this.#instance.UI.searchTextFull('', this.searchOptions);
|
||||||
}
|
}
|
||||||
@ -292,13 +297,13 @@ export class PdfViewer {
|
|||||||
|
|
||||||
#listenForShift() {
|
#listenForShift() {
|
||||||
this.#instance.UI.iframeWindow.addEventListener('keydown', e => {
|
this.#instance.UI.iframeWindow.addEventListener('keydown', e => {
|
||||||
e.preventDefault();
|
if (e.target === this.#searchInput) return;
|
||||||
if (e.key === 'Shift') {
|
if (e.key === 'Shift') {
|
||||||
this.#setSelectionMode(SelectionModes.RECTANGULAR);
|
this.#setSelectionMode(SelectionModes.RECTANGULAR);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.#instance.UI.iframeWindow.addEventListener('keyup', e => {
|
this.#instance.UI.iframeWindow.addEventListener('keyup', e => {
|
||||||
e.preventDefault();
|
if (e.target === this.#searchInput) return;
|
||||||
if (e.key === 'Shift') {
|
if (e.key === 'Shift') {
|
||||||
this.#setSelectionMode(SelectionModes.STRUCTURAL);
|
this.#setSelectionMode(SelectionModes.STRUCTURAL);
|
||||||
}
|
}
|
||||||
@ -395,13 +400,11 @@ export class PdfViewer {
|
|||||||
if (this.#isElementActive('textPopup')) {
|
if (this.#isElementActive('textPopup')) {
|
||||||
this.#instance.UI.closeElements(['textPopup']);
|
this.#instance.UI.closeElements(['textPopup']);
|
||||||
}
|
}
|
||||||
const iframeWindow = this.#instance.UI.iframeWindow;
|
if (this.#searchInput) {
|
||||||
const input = iframeWindow.document.getElementById('SearchPanel__input') as HTMLInputElement;
|
this.#searchInput.focus();
|
||||||
if (input) {
|
|
||||||
input.focus();
|
|
||||||
}
|
}
|
||||||
if (input?.value?.length > 0) {
|
if (this.#searchInput?.value?.length > 0) {
|
||||||
input.select();
|
this.#searchInput.select();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user