You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On desktop, VS Code's webviews using the electron <webview> tag. This gives a nice api for searching inside a webview
However on web we use normal iframes for webviews. These currently don't support the search functionality because there is no equivalent API for searching inside a iframe.
This is one blocker for using normal iframes for the webviews in desktop VS Code: #83188
Request
Implement search for iframe based webviews. This should attempt to match the behavior of the existing search functionality as much as possible
I still think this behaviour differs too much from the way the find widget currently works with webviews to be worth implementing.
It's closer to the search viewlet behaviour, but even that doesn't have the problem of focus being stolen away from the searchbox during searches.
Matt Bierner (@mjbvz) any chance we could get ea8c6b3 into our builds? I have iframe based webviews enabled via settings ("webview.experimental.useIframes": true) and in markdown preview I am currently greeted with this:
My rationale is that I would like to selfhost on Raymond Zhao (@rzhao271) changes for enabling find in iframes, but currently that is impossible.
Activity
mjbvz commentedon Apr 27, 2020
Solutions investigated:
Window.find— Non-standard. Doesn't provide enough controlJavaScript library (such as mark.js) — Requires JS on page. Modifies page content
Find text and other proposals — Never standardized and no longer active :(
mjbvz commentedon Feb 27, 2021
I've explored various ways to implement this. There are two parts to this:
Performing the search in the webview document itself.
Here we need to get a list of ranges. This is more complicated than it may sound since a search result may span multiple html nodes
Highlight the results
The only way I found that might let us do this somewhat reliably is
execCommand('backColor'). This API is terrible to work with34 remaining items
rzhao271 commentedon May 26, 2021
I still think this behaviour differs too much from the way the find widget currently works with webviews to be worth implementing.
It's closer to the search viewlet behaviour, but even that doesn't have the problem of focus being stolen away from the searchbox during searches.
bpasero commentedon May 28, 2021
Matt Bierner (@mjbvz) any chance we could get ea8c6b3 into our builds? I have iframe based webviews enabled via settings (
"webview.experimental.useIframes": true) and in markdown preview I am currently greeted with this:My rationale is that I would like to selfhost on Raymond Zhao (@rzhao271) changes for enabling find in iframes, but currently that is impossible.
bpasero commentedon Jun 1, 2021
Next steps:
window.findmainto enable for users with"webview.experimental.useIframes": trueAdd search for iframe based webviews
Add search for iframe based webviews
Add iframe search with debounce (#125856)