You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Move from Webview.onDidBecomeActive/Webview.onDidBecomeInactive to an API closer to window.onDidChangeActiveTextEditor. Current proposal: window.onDidChangeActiveWebview. Would be fired with undefined when a user switches to a normal text editor. Also would be fired when a webview changes columns.
Matt Bierner (@mjbvz) Do we have an event for when a webview is closed?
Is there a way to determine whether a particular webview was closed?
Currently when using ContentProvider (via registerTextDocumentContentProvider), VSCode manages this for us with a one-to-one relationship between a URI and a window. I.e. if the window is closed and we open it again using the previewHtml, VS Code will open a new window, where as if the window isn't closed VS Code will merely activate the existing window.
With this new api, I have no way of determining whether the WebView has been closed or not and whether we need to create a new WebView for display.
This PR introduces a different model for webviews. There is now a 1:1 correspondence between webviews and "webview editors". Previously, users could split webview editors, resulting in two different webview editors both backed by the same model. This is no longer possible
Just for reference the request for webviews in other contexts does already exist: #43049 (there are probably other requests as well) and TBH I have a very real need for that support (a webview in at least the sidebar or panel) for a new extension I'm working on.
Reacted by Mike Lischke, Akonwi Ngoh, Yukai Huang and Alexander
Matt Bierner (@mjbvz) Is there a way to focus a webview when its already visible? The reveal method only seems to focus if the panel isn't already in the requested column.
Yeah today's. It will focus it if it changes viewcolumns but if it is already in col 3 but another tab in col 1 or 2 is focused and I reveal to col 3 it doesn't focus it
Activity
[-]Propose new Webview APi[/-][+][Plan Item] Propose new Webview API[/+]mjbvz commentedon Feb 15, 2018
Initial version of API taken into proposed with #42690
mjbvz commentedon Feb 15, 2018
Proposed API changes for next iteration:
Add a
Webview.viewColumproperty:readonly viewColumn?: ViewColumn;.Rename
WebviewOptions.keepAliveto make it more clear what this property actually doesRename
Webview.onMessageper Better UI extensibility: retain webviews, provide communication channel #28263 (comment)Move from
Webview.onDidBecomeActive/Webview.onDidBecomeInactiveto an API closer towindow.onDidChangeActiveTextEditor. Current proposal:window.onDidChangeActiveWebview. Would be fired withundefinedwhen a user switches to a normal text editor. Also would be fired when a webview changes columns.// cc Ivan Kravets (@ivankravets) Eric Amodio (@eamodio) Pavel Feldman (@pavelfeldman)
DonJayamanne commentedon Feb 23, 2018
Deleted the comment, was using localstorage, don't need it as I can persist the webview.
👍
DonJayamanne commentedon Feb 23, 2018
Matt Bierner (@mjbvz) Do we have an event for when a webview is closed?
Is there a way to determine whether a particular webview was closed?
Currently when using ContentProvider (via
registerTextDocumentContentProvider), VSCode manages this for us with a one-to-one relationship between a URI and a window. I.e. if the window is closed and we open it again using the previewHtml, VS Code will open a new window, where as if the window isn't closed VS Code will merely activate the existing window.With this new api, I have no way of determining whether the WebView has been closed or not and whether we need to create a new WebView for display.
octref commentedon Feb 23, 2018
Can we have API for icon/favicon of the webview?
Webview API prototype 3
mjbvz commentedon Feb 24, 2018
Don Jayamanne (@DonJayamanne) Just sent out a new proposal that introduces an
onDisposeevent on the webview: #44307This PR introduces a different model for webviews. There is now a 1:1 correspondence between webviews and "webview editors". Previously, users could split webview editors, resulting in two different webview editors both backed by the same model. This is no longer possible
Webview API prototype 3
12 remaining items
eamodio commentedon Mar 14, 2018
Just for reference the request for webviews in other contexts does already exist: #43049 (there are probably other requests as well) and TBH I have a very real need for that support (a webview in at least the sidebar or panel) for a new extension I'm working on.
Promote webview Api to stable (#47989)
eamodio commentedon Apr 19, 2018
Matt Bierner (@mjbvz) Is there a way to focus a webview when its already visible? The
revealmethod only seems to focus if the panel isn't already in the requested column.mjbvz commentedon Apr 19, 2018
This is what
revealshould do. Are you on insiders?eamodio commentedon Apr 19, 2018
Yeah today's. It will focus it if it changes viewcolumns but if it is already in col 3 but another tab in col 1 or 2 is focused and I reveal to col 3 it doesn't focus it
mjbvz commentedon Apr 19, 2018
Can you open an new issue. Also are you calling it with the view column:
.reveal(webview.viewColumn)?eamodio commentedon Apr 19, 2018
Out right now but will do when I get back. Basically.
.reveal(ViewColumn.Three)whenwebview.viewColumnis also 3