Improving ux for search in webviews on web

This commit is contained in:
Matt Bierner 2021-11-19 16:00:50 -08:00
parent e784e88a87
commit bbc10afeda
No known key found for this signature in database
GPG key ID: 099C331567E11888

View file

@ -994,13 +994,18 @@ onDomReady(() => {
if (!target) {
return;
}
// Reset selection so we start search after current find result
const selection = target.contentWindow.getSelection();
selection.collapse(selection.anchorNode);
const didFind = (/** @type {any} */ (target.contentWindow)).find(
data.value,
false,
/* caseSensitive*/ false,
/* backwards*/ data.previous,
/* wrapAround*/ true,
false,
/*aSearchInFrames*/ true,
/* wholeWord */ false,
/* searchInFrames*/ false,
false);
hostMessaging.postMessage('did-find', didFind);
});