wry icon indicating copy to clipboard operation
wry copied to clipboard

feat: add find-in-page, closes #585

Open keiya01 opened this issue 3 years ago • 8 comments

What kind of change does this PR introduce?

  • [ ] Bugfix
  • [x] Feature
  • [ ] Docs
  • [ ] New Binding issue #___
  • [ ] Code style update
  • [ ] Refactor
  • [ ] Build-related changes
  • [ ] Other, please describe:

Does this PR introduce a breaking change?

  • [ ] Yes, and the changes were approved in issue #___
  • [x] No

Checklist

  • [x] When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • [x] A change file is added if any packages will require a version bump due to this PR per the instructions in the readme.
  • [x] I have added a convincing reason for adding this feature, if necessary

Other information

keiya01 avatar May 22 '22 02:05 keiya01

This feature highlight the search text automatically. Also electron has this feature. Searching word on browser by using JavaScript is too heavy process. And I think we should provide this feature from wry if it is possible.

keiya01 avatar May 22 '22 09:05 keiya01

Ah I see, I didn't know it highlights it too. I see that electron has this event https://www.electronjs.org/docs/latest/api/web-contents#event-found-in-page with information about the matched text, can we provide some of these?

amrbashir avatar May 22 '22 09:05 amrbashir

I want to provide these information but I can't find API to do it :(

keiya01 avatar May 22 '22 13:05 keiya01

Additionally wkwebview.findString API has restriction that text is not highlighted only on macOS (but text is selected like window.find). This is the issue in webkit: https://bugs.webkit.org/show_bug.cgi?id=140210.

keiya01 avatar May 22 '22 13:05 keiya01

Also electron has this feature.

If electron has it, it should be possible for webview2 perhaps (since they are both chromium)? This method will be really awkward if it doesn't support Windows which is the major desktop most users use

wusyong avatar May 23 '22 10:05 wusyong

Webview2 builtin these feature with search box. But webview2 doesn't provide the API to find text in page :(

keiya01 avatar May 23 '22 12:05 keiya01

Maybe worth opening a feature request at webview2 feedback repo and hold this PR until it happens?

amrbashir avatar May 23 '22 13:05 amrbashir

How about using window.find through evaluate_script as a fallback for WebView2?

I sill don't see much value in this API

Many projects are using the same functionality in Electron. https://github.com/search?l=TypeScript&q=findInPage+electron&type=Code

This functionality is useful for some document viewer to search its content.

rhysd avatar Nov 05 '22 05:11 rhysd