Skip to content

[Plan Item] Propose new Webview API #43713

Closed

Description

@mjbvz

Follow up on #41047 which explored improving the webview API. Part of #28263

This iteration we'd like to move the new API to be a fully documented proposed API and also self-host the markdown extension on the new API

Activity

  1. added
    plan-item
    on Feb 15, 2018
  2. changed the title [-]Propose new Webview APi[/-] [+][Plan Item] Propose new Webview API[/+] on Feb 15, 2018
  3. mjbvz commented on Feb 15, 2018

    @mjbvz
    ContributorAuthor

    Initial version of API taken into proposed with #42690

  4. mjbvz commented on Feb 15, 2018

    @mjbvz
    ContributorAuthor

    Proposed API changes for next iteration:

    • Add a Webview.viewColum property: readonly viewColumn?: ViewColumn;.

    • Rename WebviewOptions.keepAlive to make it more clear what this property actually does

    • Rename Webview.onMessage per Better UI extensibility: retain webviews, provide communication channel #28263 (comment)

    • 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.

    // cc Ivan Kravets (@ivankravets) Eric Amodio (@eamodio) Pavel Feldman (@pavelfeldman)

  5. DonJayamanne commented on Feb 23, 2018

    @DonJayamanne
    Contributor

    Deleted the comment, was using localstorage, don't need it as I can persist the webview.
    👍

  6. DonJayamanne commented on Feb 23, 2018

    @DonJayamanne
    Contributor

    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.

  7. octref commented on Feb 23, 2018

    @octref
    Contributor

    Can we have API for icon/favicon of the webview?

  8. added a commit that references this issue on Feb 23, 2018
  9. mjbvz commented on Feb 24, 2018

    @mjbvz
    ContributorAuthor

    Don Jayamanne (@DonJayamanne) Just sent out a new proposal that introduces an onDispose event on the webview: #44307

    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

  10. added a commit that references this issue on Feb 26, 2018
  11. 12 remaining items

  12. eamodio commented on Mar 14, 2018

    @eamodio
    Contributor

    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.

  13. added a commit that references this issue on Apr 19, 2018
    91191fb
  14. eamodio commented on Apr 19, 2018

    @eamodio
    Contributor

    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.

  15. mjbvz commented on Apr 19, 2018

    @mjbvz
    ContributorAuthor

    This is what reveal should do. Are you on insiders?

  16. eamodio commented on Apr 19, 2018

    @eamodio
    Contributor

    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

  17. mjbvz commented on Apr 19, 2018

    @mjbvz
    ContributorAuthor

    Can you open an new issue. Also are you calling it with the view column: .reveal(webview.viewColumn)?

  18. eamodio commented on Apr 19, 2018

    @eamodio
    Contributor

    Out right now but will do when I get back. Basically. .reveal(ViewColumn.Three) when webview.viewColumn is also 3

  19. locked and limited conversation to collaborators on Jun 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

on-testplanplan-item

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions