VSCodium / vscodium

binary releases of VS Code without MS branding/telemetry/licensing
https://vscodium.com
MIT License
24.29k stars 1.02k forks source link

Find widget and clipboard commands within webviews don't work; cannot search `WebviewPanel` with `enableFindWidget: true`; can't cut, copy or paste #1860

Open geekley opened 2 months ago

geekley commented 2 months ago

Describe the bug Extensions can contribute custom editors, etc. using WebviewPanel. When one is created, WebviewPanelOptions can have enableFindWidget: true, which enables a find widget on the webview that can be used with CtrlF, just like in any browser.

In MS VSCode, it works as expected, even highlighting occurrences and everything. In Codium, the find widget opens, but it doesn't work at all.

This is a problem, as extensions can often use webviews to display complex webpages, e.g. documentation; where often the user needs to be able to search for text. Forcing extension authors to implement custom search functionality just for Codium is not a viable option, as those webpages can often be from an external source like a website.

A place where you can easily see the issue is in "Show Release Notes", where the webview is not searchable in Codium.

Please confirm that this problem is VSCodium-specific

Please confirm that the issue/resolution isn't already documented

To Reproduce Simplest steps to quickly reproduce the behavior:

  1. Open an untitled markdown file and type a bunch of text.
  2. Click on 'Open Preview to the side'.
  3. Click on the preview and hit Ctrl+F to show the find widget.
  4. Search for some text, the use ENTER or the arrows.

Expected behavior In MS VSCode, it works, finding the text, scrolling to it, and even highlighting all occurrences as you type on the search box. In MS VSCode for the Web (testing an extension in a browser IDE with vscode-test-web), it works too, though it won't highlight occurrences.

In Codium, the find widget opens, but it doesn't work at all. Typing won't highlight occurrences, or enable the previous/next match arrow buttons. Enter doesn't find anything either. Using the dev tools Console, and selecting the webview frame context, you can run JS API window.find just fine, so it's some issue involving the find widget itself, or possibly Chromium/Electron.

Screenshots Codium: Find widget in webview not working in Codium MS VSCode: Find widget in webview works in MS VSCode

Desktop (please complete the following information):

Additional context Compared against the Flatpak version of MS VSCode v1.88.0 on the same machine:

Version: 1.88.0
Commit: 5c3e652f63e798a5ac2f31ffd0d863669328dc4c
Date: 2024-04-03T13:25:57.039Z
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Linux x64 6.5.0-28-generic
geekley commented 2 months ago

Another bug: just found out that the Cut/Copy/Paste commands within a webview also don't work in Codium, though they do in MS VSCode. Tried the Copy command in both context menu and Ctrl+C shortcut. To reproduce, test it in the same places described above.

daiyam commented 2 months ago

I can confirm the bug on macOS.

geekley commented 2 months ago

In case it helps, I just tested this (using extension API), it seems even manually executing commands like vscode.commands.executeCommand('editor.action.webvieweditor.findNext') and .findPrevious won't work. These are the equivalent of the UI arrow buttons, it seems. For context, commands editor.action.webvieweditor.showFind/.hideFind do work as expected.

jrm-omg commented 3 weeks ago

Same issue here (v 1.90.1 - linux mint) Also tried to codium --disable-extensions but same issue