Repository navigation
Webview Api Prototype - #41853
Webview Api Prototype#41853Matt Bierner (mjbvz) wants to merge 4 commits into
Conversation
Proposes a new Api for creating webviews. This API aims to make the current html preview api more usable, safer, and more extensible for the future.
2d0c765 to
c42b0c8
Compare
|
Very nice to see there's further development going on with the previewHTML feature. Btw, that name "previewHTML" is probably not a good choice. I use it not at all for HTML (related) previews but as a custom renderer. A better name is probably "embeddedHTML" or similar... And here a few points I have:
One big wish I have here, however, is better communication between the HTML view and the extension. Take for instance this diagram I have in my antlr4-vscode extension: This is a D3.js generated graph with interaction (e.g. the nodes can be moved with the mouse, you can scale and pan the view etc.). However, having to reposition the nodes each time you open the view would be a nightmare, so I store the positions when a new provide-html-text request comes in. For that I need a pretty dirty hack, by sending a message to the view, which then sends back status to the extension. There should be a way to directly interact with the view. Maybe implement an |
|
Mike Lischke (@mike-lischke) These changes will not effect the existing As to your points:
|
Ah, a new approach instead of reworking the old one. I'm fine with that as well. Pushing content will allow for much better interaction (e.g to push data changes which is then visualized with animations).
Good, an official API is way better. Still, it would also require to send messages around, which is suboptimal, as it may require to send large pieces of text, URL encoded, as parameters of a URI. All but elegant. There should be something to directly execute JS to set and get values. |
|
Johannes Rieken (jrieken)
left a comment
There was a problem hiding this comment.
Quick scan looks good. Not the editor-input-expert but I believe that's how you should use it.
|
Moved work onto branch on master: #42690 |

#41047
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 objectenableCommandUrisoption actually enable command uris