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

Cannot Capture File->Save menu option when using a webview #60801

Closed
allenoleksak opened this issue Oct 12, 2018 · 9 comments · Fixed by #80337
Closed

Cannot Capture File->Save menu option when using a webview #60801

allenoleksak opened this issue Oct 12, 2018 · 9 comments · Fixed by #80337
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug menus Menu items and widget issues verified Verification succeeded

Comments

@allenoleksak
Copy link

We have a use case where we have created our own extension to open certain file extensions via a webview. This basically allows the user to enter meta data stored in json in a more visual way. One issue we are running into though is since we are using a webview, if the user selects File->Save or any of those save commands, we aren't able to capture that.

We need an event to get fired if the user does that and a WebView is the current active editor.

@vscodebot
Copy link

vscodebot bot commented Oct 12, 2018

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@mjbvz
Copy link
Contributor

mjbvz commented Oct 15, 2018

@sbatten With your work, won't the save menu item be disabled if there is no active editor?

@allenoleksak
Copy link
Author

@mjbvz @sbatten

If the plan is to disable it, that may also work in our case. At least that way the user isn't confused, thinking they are saving using the file menu. We can add our own save buttons in the webview in that case.

@allenoleksak
Copy link
Author

Closed by mistake

@sbatten
Copy link
Member

sbatten commented Oct 18, 2018

@mjbvz yes, we should add that context key to save and save as...

@mjbvz mjbvz added the menus Menu items and widget issues label Oct 27, 2018
@sbatten sbatten modified the milestones: Backlog, February 2019 Feb 1, 2019
@sbatten sbatten added the bug Issue identified by VS Code Team member as probable bug label Feb 1, 2019
@sbatten sbatten closed this as completed in c3b9299 Feb 1, 2019
@bpasero bpasero reopened this Feb 4, 2019
@bpasero
Copy link
Member

bpasero commented Feb 4, 2019

@sbatten sorry but I had to revert this change as it imho breaks our layers. Checking https://github.com/Microsoft/vscode/wiki/Code-Organization#workbench-parts there is:

think twice before letting a part depend on another part: is that really needed and does it make sense? Can the dependency be avoided by using the workbench extensibility story maybe?

In this case we suddenly make the files contribution depend on the welcome experience. Is that really a good idea? I would prefer a clean solution where e.g. we introduce a new context key that is managed by the workbench and is updated when editors change by asking them if they can be saved or not. This may not exist yet, but we can easily add more methods to editors (or inputs) to support that.

@sbatten
Copy link
Member

sbatten commented Feb 4, 2019

fair enough. I would argue that this isn't a hard dependency in that the removal of the welcome ex does not change its behavior, but I understand the idea. I don't want to be maintaining this list if it grows, either. I did not find a reliable dirtyEditor context key or similar, but we can add one.

@bpasero
Copy link
Member

bpasero commented Feb 5, 2019

isn't a hard dependency in that the removal of the welcome ex does not change its behavior

How is this not a hard dependency? We will not be able to bundle the file explorer alone without the welcome code unless we remove the import statements.

I did not find a reliable dirtyEditor context key or similar, but we can add one.

I think handleContextKeys would be a good start to add this. It is the one that already reacts to editors changing. We can look into this when you are here 👍

@sbatten
Copy link
Member

sbatten commented Feb 5, 2019

We will not be able to bundle the file explorer alone without the welcome code unless we remove the import statements.

My mistake, forgot I actually used the id variable and not just the string literal.

@sbatten sbatten modified the milestones: February 2019, March 2019 Feb 21, 2019
@sbatten sbatten modified the milestones: March 2019, April 2019 Mar 25, 2019
@sbatten sbatten modified the milestones: April 2019, May 2019 May 6, 2019
sbatten added a commit to sbatten/vscode that referenced this issue May 6, 2019
@sbatten sbatten modified the milestones: May 2019, June 2019 May 28, 2019
@sbatten sbatten modified the milestones: June 2019, July 2019 Jun 24, 2019
@sbatten sbatten modified the milestones: July 2019, August 2019 Aug 1, 2019
@sbatten sbatten modified the milestones: August 2019, September 2019 Aug 29, 2019
@mjbvz mjbvz added the verified Verification succeeded label Oct 3, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug menus Menu items and widget issues verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants