Commit Graph

42 Commits

Author SHA1 Message Date
Matt Bierner
8578f0241e Add preserveFocus option for webviews
Fixes #14311
2018-04-27 16:40:45 -07:00
Matt Bierner
216151379f Make webview options optional
Fixes #48594
2018-04-27 16:02:48 -07:00
Matt Bierner
d770ce503a Make sure we handle webview position updates when an entire editor group moves 2018-04-19 16:35:17 -07:00
Matt Bierner
91191fb866 Promote webview Api to stable (#47989)
* Promote webview Api to stable

Fixes #43713
Fixes #28263

* Rename position back to viewColumn and mark viewColumn as deprecated

This allows us to more easily re-introduce a `position` property once we have gridlayout

* Move dispose methods onto webview itself

Also better hide a few 'internal' methods / properties on the panel / webview

* Revert "Move dispose methods onto webview itself"

This reverts commit 8fab6cc1a1.

* Move title onto webview panel

* Use _ names for private setters

* Remove unused emitter and dispose onMessageEmitter

* Preview internal emitters with _
2018-04-19 10:55:49 -07:00
Matt Bierner
52a75ecf23 Use correct $name for onDidDisposeWebviewPanel event
Fixes #48127
2018-04-18 11:32:29 -07:00
Matt Bierner
cdd9a731f9 Use standard 'postMessage' name 2018-04-17 16:22:44 -07:00
Matt Bierner
fbd3a08369 Pass Webview into ExtHostWebviewPanel instead of creating it inside the ctor 2018-04-17 16:20:27 -07:00
Matt Bierner
ea680fae1c Update to use more consistent WebviewPanel naming 2018-04-17 10:36:56 -07:00
Matt Bierner
e4c975592b Webview panels start out as visible 2018-04-16 11:50:51 -07:00
Matt Bierner
71c09a6c4c weview -> webview 2018-04-16 11:50:51 -07:00
Matt Bierner
06c070690e Also fire webview dispose event when dispose is called 2018-04-16 11:50:51 -07:00
Matt Bierner
4f880aaf59 Rename webview.viewColumn to the more generic webview.position 2018-04-12 14:25:55 -07:00
Matt Bierner
e16ec3c1ff Tweak WebviewPanelOnDidChangeViewStateEvent to only provide a webview panel
Expose a webview panel's view state as properties. Make WebviewPanelOnDidChangeViewStateEvent only fire an event with the webview who's state changed
2018-04-12 14:22:42 -07:00
Matt Bierner
23113a4443 Using consistent internal name 2018-04-12 14:22:42 -07:00
Matt Bierner
a2346c606d Rename WebviewEditor to WebviewPanel 2018-04-12 12:06:07 -07:00
Matt Bierner
8cb7e80544 Split out Webview from WebviewEditor in proposed API (#47370)
* Split out `Webview` from `WebviewEditor` in API

**Problem**
The current proposed `Webview` interface has a few methods and properties that are very editor specific, such as `.reveal` and `.onDidChangeViewState`. These properies will not make sense if we ever allow webview to be displayed in other locations, such as in widgets

**Proposal**
Split the concepts of a `Webview` and of a `WebveiwEditor`. A webview is the html content itself. A `WebviewEditor` is an editor that displays a `Webview`

This would allow us to easily add other types of `Webview` owning objects in the future without having to document that some methods only apply when a webview is used as an editor vs as a widget
2018-04-11 11:49:02 -07:00
Matt Bierner
52c293a050 Fix webview type name casing 2018-04-06 17:09:41 -07:00
Matt Bierner
d855ec8060 Reduce duplicate state for active webviews 2018-04-06 16:06:44 -07:00
Matt Bierner
75ecc5ef29 Delete now unused webview.state 2018-04-05 23:14:04 -07:00
Matt Bierner
6c139ab333 Move all private properties together 2018-04-05 23:14:04 -07:00
Matt Bierner
c14e30aeb4 Show error when webview restore fails 2018-04-05 19:18:55 -07:00
Matt Bierner
e873a42e27 Fix possible webview exception 2018-04-05 19:02:35 -07:00
Matt Bierner
d0f7d2e8da Fix compile error 2018-04-05 10:23:23 -07:00
Matt Bierner
caee7a5789 Working on progress indicator when loading webview 2018-04-05 10:16:39 -07:00
Matt Bierner
dd21d3520a Add webview restoration api proposal (#46380)
Adds a proposed webiew serialization api that allows webviews to be restored automatically when vscode restarts
2018-04-03 18:25:22 -07:00
Matt Bierner
67d8eebaf4 Rename webview.show to webview.reveal
Make it more clear that this command only reveals an existing webview

Fixes #44580
2018-03-20 16:16:05 -07:00
Matt Bierner
ea1fed9616 Use viewType instead of uri for webviews
As discussed in #45994, move from using a uri to using a viewType. The view type is shared among all webviews of a given type, such as all markdown previews

Fixes #44575
2018-03-20 14:44:10 -07:00
Matt Bierner
27a17935b8 Move webview to use onDidChangeViewState event
After discussions, we settled on making the webview private unlike `TextEditors`. This means that webview events will live on the webview object itself

Fixes #44571
2018-03-20 14:30:39 -07:00
Matt Bierner
81767beaca Make Event a named export
There are many places in the code that do `import Event, { ...} from '.../event'`.
2018-03-14 14:25:30 -07:00
Matt Bierner
82084be1bc Switch to use vscode-resource scheme in webviews
Fixes #45784
2018-03-14 11:25:40 -07:00
Matt Bierner
68c78176af Fixes unknown webview on postMessage
Fixes #45555. These errors will now show up in #45553
2018-03-13 14:24:56 -07:00
Matt Bierner
5994f5f90e Fix onDidChangeActiveWeview not getting fired when switching away from webviews 2018-02-28 18:09:50 -08:00
Matt Bierner
66d38d0702 Use native promise 2018-02-28 18:09:49 -08:00
Matt Bierner
92a8e702b7 Make sure we clean up disposed webview 2018-02-28 18:09:49 -08:00
Matt Bierner
b60267b17c Delete webview input on dispose 2018-02-28 00:25:13 -08:00
Matt Bierner
a989220093 Add title to webviewCreate
Part of #44579
2018-02-28 00:25:13 -08:00
Matt Bierner
6b743d8c61 Prevent multiple markdown previews of the same type in the same editor group 2018-02-26 16:35:57 -08:00
Matt Bierner
4d95590a81 Use onDid* type event names in webview 2018-02-26 15:51:15 -08:00
Matt Bierner
26cbbea694 Add webview.show method to show a webview in a given group
Fixes #44430
2018-02-26 12:56:23 -08:00
Matt Bierner
2038b8fc7f Webview API prototype 3 (#44307)
* Webview API prototype 3

Part of #43713

Third try at refining the webview api. This pass reworks  #44165.  Major changes:

- Adds an `id` field to webviews. The id is provided by the extension and identifies the webview. It is used with the new event handling apis.

- Adds a new `onDidChangeActiveEditor` api. This is similar to `onDidChangeActiveTextEditor` but is also fired when you change webviews. It replaces the old `onFocus` and `onBlur` events on the webview itself

- Adds an `onDispose` event ot webviews. This is fired when a webview is closed by the user

- Perist webview state when the editor group changes. This is enabled for all webviews, not just those with keep alive.

* Throw error when trying to access disposed webview

* Improving webview documentation

* Clean up dispose management

* Throw if we receive a bad handle

* Move more event handling to input

* Simplify input updating

* Remove extra container property

* Fixing md security alert button

* Remove extra update container call

* Restore syncing of preview to active editor

* Fixing posting to webview

* Debounce preview updates

* Remove previewUri

* Enable direct window.postMessage instead of window.parent.postMessage

* Fixing scroll position not preserved when updating previews

* Revert parent.postMessage change.

Old behavior was correct

* Properly hide webview container on tab switch

* Make sure we only handle scroll events for the correct document

* Don't try setting negative scroll

* Revert vs code whitespace change
2018-02-26 10:06:50 -08:00
Matt Bierner
c37e742023 Hookup basic webview.viewColumn 2018-02-15 15:27:39 -08:00
Matt Bierner
3412eab2ec Webview Api Prototype (#42690)
* Webview api

* Cleaning up markdown webview

* Hooking up dispose

* Fix some merge errors

* Use custom context key to show markdown title bar contributions

* Add basic on focus and on blur events

* Fixing find widget in webview

* Hookup _isDisposed

* Use new extension resource scheme to load markdown extension resources

* Documenting keep alive
2018-02-14 18:52:26 -08:00