-
Notifications
You must be signed in to change notification settings - Fork 29.5k
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
Webview Api Prototype #42690
Webview Api Prototype #42690
Conversation
A suggestion: allow reading the current content of the view as text. This way it's possible to see the actual HTML text, including what vscode added/changed (and store it on disk, for further use). And I would love to see a way to access variables in the DOM. That doesn't require to make the entire DOM public, just a way to read and set variables. This would make updating a webview a lot simpler, without fully reloading it. It would also allow to save and restore state, in case such a view must be generated the same way as it was when the user left it. |
@mike-lischke This new API makes it easier to implement that functionality if you would find it useful. They are a bit too high level in my view for the vscode core api |
Thanks @mjbvz, I'll certainly give it a try. The simplified messaging looks good, I can probably come up with a function that allows to update variables via that. Does |
@mjbvz Will you add a WebView example to https://github.com/Microsoft/vscode-extension-samples? |
@mjbvz when the WebView can be used in the extension development? |
Moving #41853 to branch on main repo
Proposes a new Api for webviews. This API aims to make the current html preview api more usable, safer, and more extensible for the future.
Besides the new API, the new webviews also differ in several important ways:
file://
origin so they can't read files on disk (you have to use the new protocols for this)postMessage
inside of webviews now posts back to vscode directly (no more weird click faking required)TODO
onFocus
andonBlur
to the webview objectAdd editorColumn property on webviewenableCommandUris
option actually enable command uris