-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Contributed webview context menu actions #54285
Comments
This comment has been minimized.
This comment has been minimized.
Any update on this issue? It's been on the backlog for quite a while now. |
I've also thought about creating this request. Right now extensions need to build their own context menu widget which is obviously a pain and even done perfectly would look out of place on mac since it uses native menus. |
My idea is adding an API that wraps Electron's const template = [
{
label: 'Menu Item 1',
click: () => { console.log('click') }
},
{ type: 'separator' },
{ label: 'Menu Item 2', type: 'checkbox', checked: true }
]
vscode.window.openContextMenu(position, template) When you want to open a custom context menu instead of the default one, you colud preventDefault contextmenu event and use |
Would love to get some updates on this as well. Thanks! |
Some of the duplicate issues listed above refer to custom editors. This issue seems to be limited to web views. It would be helpful to either include custom editors in the title here. I would argue that the custom view/editor support in the extension API is incomplete without context menu support. The default context menu with Copy, Cut, and Paste may not make sense for a custom interface (not to mention appears not to work - I can provide details if needed). VS Code is too mature IMO to have this functionality omitted at this point. |
Does this work and if so how? I can't seem to find any documentation for it. If i've contributed my own webview to the debug context for instance, how do I provide a context menu for that web view? |
Another vote for this. Right now I'm using CSS/Javascript to create a context menu, but the context menu can't leave the webview render space, so in small windows the context menu is rather limited. |
I would really love to have this as well -- even if menus were a part of the https://github.com/microsoft/vscode-webview-ui-toolkit (/cc @daviddossett @hawkticehurst) that would only help for custom menus, and as other have mentioned we'd still be bound to the webview box as well, which is certainly not ideal. @mjbvz is something like this in the cards? |
@daviddossett definitely, I don't think effort in the webview toolkit would be worth it, and then you'd be stuck with an inferior version of the menu when this does happen. |
Here is another vote for having this feature supported natively. |
Reopening to track finalizing |
We held off on finalizing this last iteration so that we could think about how extensions could pass data to contributed webview context menu commands. A motivating use case: passing the value of a text input back to an extension I considered two approaches to this:
|
@mjbvz When building this I had a very similar thought to Given that, I definitely like your 2nd proposal to allow custom args to be added into the context menu event as that feels different and provides an alternative method that isn't possible with the DOM attr approach. But also agree that this type of added functionality could be layered on top of the existing proposal. |
🎉 Woo! Thanks @mjbvz! |
Feature request
Allow extensions to contribute to the context menu in a webview
(From FB meeting)
The text was updated successfully, but these errors were encountered: