Fixing the search in page for IOS

This commit is contained in:
Sergiotarxz 2023-09-11 02:27:30 +02:00
parent 8563a1bf6f
commit 07330b4678
2 changed files with 12 additions and 1 deletions

View File

@ -123,7 +123,18 @@ function addListenersSearch() {
function searchInWebsite(value, isToBottom) {
window.find(value, false, !isToBottom, true)
const selection = window.getSelection()
if (selection.anchorNode === null) {
const pageContents = document.querySelector('div.page-contents');
pageContents.focus()
searchInWebsite(value, isToBottom)
}
const anchorNode = selection.anchorNode.parentNode
if (anchorNode.tagName !== null
&& anchorNode.tagName === "INPUT") {
const pageContents = document.querySelector('div.page-contents');
pageContents.focus()
searchInWebsite(value, isToBottom)
}
if (anchorNode !== null) {
const pageContents = document.querySelector('div.page-contents');
const offsetTop = _getOffsetTopWithNParent(anchorNode, pageContents);

File diff suppressed because one or more lines are too long