Skip to content
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

Pass argument to webview context menu action #13228

Merged
merged 2 commits into from
Jan 11, 2024

Conversation

jonah-iden
Copy link
Contributor

@jonah-iden jonah-iden commented Jan 3, 2024

What it does

When executing a command via the context menu of a webview, vscode passes the context of the clicked html node to the command as an argument.
This PR aligns Theia's implementation of the webview context menu with vscode.

How to test

A small test extension can be found here.
The repo also contains a vsix file to download directly.

Go to the explorer tab, expand the Webview Test View webview. This contains two elements opening the context menu on each should return a different command because of their given context through the data-vscode-context property. Executing the command should now also include the stringified data from the vscode-data-context html-attribute

Review checklist

Reminder for reviewers

Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
@msujew msujew changed the title added the context to be passed as arg to the command as done by vscode Pass argument to webview context menu action Jan 9, 2024
Copy link
Contributor

@martin-fleck-at martin-fleck-at left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you @jonah-iden!

@msujew msujew added vscode issues related to VSCode compatibility menus issues related to the menu webviews issues related to webviews labels Jan 11, 2024
@msujew msujew merged commit c0a38ec into master Jan 11, 2024
14 checks passed
@msujew msujew deleted the jiden/webview-context-vscode-fix branch January 11, 2024 15:43
@github-actions github-actions bot added this to the 1.46.0 milestone Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
menus issues related to the menu vscode issues related to VSCode compatibility webviews issues related to webviews
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants