Open gogobd opened 1 year ago
I'll try to fix this
What do you mean by integrated Simple Browser
? Do you mean customized webview?
The thing that comes up when I press F1 and type "Simple"
The thing that comes up when I press F1 and type "Simple"
Just on my side, I can copy from & paste to the website opened by Simple Browser
command. (with version 1.78) Can you give us a sample url which is not functioning as expected?
My side can also copy, need an example of the bad case
I was trying to have "https://doc.sccode.org/" ope alongside with my code.
I was trying to have "https://doc.sccode.org/" ope alongside with my code.
thanks, I'll try to fix it
@gogobd @mjbvz It seems that this problem was caused by the iframe. We cannot listen to events inside the iframe. It seems that this is currently an unsolvable problem TAT?
I wonder where the event would get lost, it copy & paste from a separate browser works fine.
I can provide an additional example that just lead me to this thread: https://tldp.org/HOWTO/NCURSES-Programming-HOWTO/init.html
@gogobd @mjbvz It seems that this problem was caused by the iframe. We cannot listen to events inside the iframe. It seems that this is currently an unsolvable problem TAT?
So maybe related to #182642
I wonder why this isn't handled by the "outside" OS
This is happening on my Mac.
To reproduce:
Attempt to copy it
Version: 1.81.1 (Universal)
Commit: 6c3e3dba23e8fadc360aed75ce363ba185c49794
Date: 2023-08-09T22:20:33.924Z
Electron: 22.3.18
ElectronBuildId: 22689846
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Darwin arm64 22.5.0
Thanks for confirming!
From further testing, it appears that Simple Browser running inside VS Code for the Web does not suffer from this problem (I can copy text from the page inside the Simple Browser just fine).
Therefore, this issue seems to only affect Electron-based builds.
I tried again with VSC (macOS)
Version: 1.83.0 Commit: e7e037083ff4455cf320e344325dacb480062c3c Date: 2023-10-03T16:13:10.518Z (1 wk ago) Electron: 25.8.4 ElectronBuildId: 24154031 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Darwin arm64 22.5.0
and the Problem still exists...
Any news on this?
Has there been any progress?
Also facing this issue on mac, bumping for exposure. I have to inspect the html to copy
I am also facing the same issue not working with https://mantine.dev Any progress on this?
I just tried this again after quite some time and the issue is still there. Now I have Version: 1.87.2 (Universal) Commit: 863d2581ecda6849923a2118d93a088b0745d9d6
I'm particularly interested in being able t copy from https://doc.sccode.org/ and that still doesn't work. I also noticed that I can't get a context menu either when I right-click in the Simple Browser window (sometimes keyboard-shortcut ⌘-C does not work while selecting "copy" from a context menu does). Unfortunately there's no workaround, still.
I poked around a little in the code for for this one.
graph TD
vscode --> c[overlay webview container] --> i2[webview iframe/index.html] --> i3[viewer iframe] --> i4[content iframe - different origin]
i3 -- click --> ch[click handler] -- did-context-menu postmessage --> i2
The iframe that loads the Simple Browser (the "content iframe" above) is literally three iframes deep in the stack. Context menus work in ordinary webviews (two iframes deep) because of an event handler that generates window messages.
However, the content iframe (where the Simple Browser loads URLs) doesn't have event handlers attached. This isn't an oversight; it's a result of security policy. You can't listen in on events generated from frames with a different origin.
So there's probably not going to be a simple fix here. One approach would be to put some sort of event-absorbing glass over the webview so we can intercept events before they reach it. Another would be to add in a proxy layer that injects key/mouse event handlers into the HTML that's loaded in the Simple Browser, such that those events get forwarded out as window messages that can be handled in the same way as they are one layer up.
you can try this code in your iframe
document.addEventListener('keydown', function (event) {
if ((event.metaKey || event.ctrlKey) && event.key === 'v') {
document.execCommand('paste');
}
});
It's not possible to copy from or paste to the integrated Simple Browser. This feature might be very simple to implement and would bring a lot of benefit with it.