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)postMessageinside of webviews now posts back to vscode directly (no more weird click faking required)TODO
onFocusandonBlurto the webview objectAdd editorColumn property on webviewenableCommandUrisoption actually enable command uris