@codingame/monaco-vscode-api 2.1.4 → 2.2.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/contributions.js +1 -0
- package/extensions.d.ts +6 -3
- package/extensions.js +18 -7
- package/lifecycle.js +11 -3
- package/missing-services.js +55 -10
- package/monaco.js +7 -3
- package/package.json +8 -8
- package/service-override/tools/views.d.ts +98 -0
- package/service-override/tools/views.js +249 -0
- package/services.d.ts +4 -2
- package/services.js +11 -9
- package/vscode/src/vs/base/browser/deviceAccess.js +60 -0
- package/vscode/src/vs/base/browser/dom.js +18 -1
- package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +178 -0
- package/vscode/src/vs/base/browser/ui/grid/grid.js +492 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +4 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.d.ts +1 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.js +1109 -0
- package/vscode/src/vs/base/browser/ui/sash/sash.js +9 -1
- package/vscode/src/vs/base/browser/ui/splitview/splitview.d.ts +348 -1
- package/vscode/src/vs/base/common/async.js +46 -2
- package/vscode/src/vs/base/common/codicons.d.ts +579 -0
- package/vscode/src/vs/base/common/event.js +11 -2
- package/vscode/src/vs/base/common/keybindingParser.js +87 -0
- package/vscode/src/vs/base/common/network.js +1 -2
- package/vscode/src/vs/base/common/observableInternal/utils.js +1 -1
- package/vscode/src/vs/base/common/platform.js +2 -1
- package/vscode/src/vs/base/common/scrollable.d.ts +28 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/colors.js +17 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/diffEditorItemTemplate.js +214 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorViewModel.js +84 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidget.js +54 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidgetImpl.js +324 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/objectPool.js +46 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/style.css.js +4 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/utils.js +11 -0
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardLayout.js +61 -1
- package/vscode/src/vs/platform/languagePacks/common/localizedStrings.js +10 -0
- package/vscode/src/vs/platform/log/browser/log.js +24 -0
- package/vscode/src/vs/platform/product/common/product.js +1 -2
- package/vscode/src/vs/platform/userDataSync/common/abstractSynchronizer.js +772 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncStoreService.js +551 -0
- package/vscode/src/vs/platform/webview/common/mimeTypes.js +22 -0
- package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +62 -0
- package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +788 -0
- package/vscode/src/vs/workbench/browser/actions/listCommands.js +763 -0
- package/vscode/src/vs/workbench/browser/layout.d.ts +26 -0
- package/vscode/src/vs/workbench/browser/media/style.css.js +1 -1
- package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +610 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +148 -0
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/compositeBar.js +603 -0
- package/vscode/src/vs/workbench/browser/parts/compositePart.js +333 -0
- package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +221 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +1406 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +184 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +509 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorPane.d.ts +112 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +1018 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +389 -0
- package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsActions.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsCenter.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsList.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsToasts.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsActions.js +213 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsAlerts.js +73 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsCenter.js +307 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsList.js +226 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsStatus.js +218 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsToasts.js +433 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsViewer.js +436 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +643 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +377 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +66 -0
- package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +144 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +220 -0
- package/vscode/src/vs/workbench/browser/window.js +239 -5
- package/vscode/src/vs/workbench/common/configuration.js +11 -1
- package/vscode/src/vs/workbench/common/theme.js +3 -3
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +298 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +363 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +133 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentGlyphWidget.js +90 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentMenus.js +43 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentService.js +317 -2
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadRangeDecorator.js +107 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +395 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/comments.js +3 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +1277 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsFilterOptions.js +17 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsModel.js +123 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +342 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +451 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsViewActions.js +176 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/media/panel.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/comments/common/commentModel.js +35 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +16 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +143 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +212 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +76 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +61 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +117 -0
- package/vscode/src/vs/workbench/contrib/editSessions/common/editSessions.js +62 -0
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +5 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +77 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorHandler.js +72 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +254 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +97 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +442 -0
- package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +430 -0
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +784 -0
- package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +487 -0
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +521 -0
- package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +150 -0
- package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +61 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveDocumentService.js +25 -1
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +178 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveHistoryService.js +49 -0
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +408 -0
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/limitIndicator/browser/limitIndicator.contribution.js +145 -0
- package/vscode/src/vs/workbench/contrib/mappedEdits/common/mappedEdits.contribution.js +22 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +691 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +238 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +76 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +40 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +69 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +346 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +96 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +144 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +103 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +399 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +195 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +39 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +126 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +611 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +156 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +262 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +171 -0
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffSourceResolverService.js +41 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +317 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +56 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +315 -0
- package/vscode/src/vs/workbench/contrib/preferences/browser/keyboardLayoutPicker.js +193 -0
- package/vscode/src/vs/workbench/contrib/preferences/common/preferences.js +2 -1
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.contribution.js +37 -0
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.js +39 -0
- package/vscode/src/vs/workbench/contrib/speech/common/speechService.js +138 -2
- package/vscode/src/vs/workbench/contrib/tags/browser/workspaceTagsService.js +12 -0
- package/vscode/src/vs/workbench/contrib/tags/common/workspaceTags.js +3 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +281 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +358 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +131 -0
- package/vscode/src/vs/workbench/contrib/update/common/update.js +2 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +288 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +94 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +86 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +77 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +646 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +63 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +57 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +140 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +119 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +67 -0
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +233 -0
- package/vscode/src/vs/workbench/services/activity/browser/activityService.js +143 -0
- package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +0 -3
- package/vscode/src/vs/workbench/services/driver/browser/driver.js +184 -0
- package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +668 -0
- package/vscode/src/vs/workbench/services/history/browser/historyService.js +1482 -0
- package/vscode/src/vs/workbench/services/layout/browser/layoutService.js +17 -1
- package/vscode/src/vs/workbench/services/lifecycle/common/lifecycle.js +8 -1
- package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +4 -0
- package/vscode/src/vs/workbench/services/progress/browser/progressService.js +521 -0
- package/vscode/src/vs/workbench/services/textMate/common/TMGrammars.js +102 -0
- package/vscode/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.js +296 -0
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +99 -0
- package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +711 -0
- package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +596 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
|
|
3
|
+
import { IContextViewService } from '../../../../platform/contextview/browser/contextView.js';
|
|
4
|
+
import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js';
|
|
5
|
+
import { SimpleFindWidget } from '../../codeEditor/browser/find/simpleFindWidget.js';
|
|
6
|
+
import { KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED } from './webview.js';
|
|
7
|
+
let WebviewFindWidget = class WebviewFindWidget extends SimpleFindWidget {
|
|
8
|
+
async _getResultCount(dataChanged) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
constructor(_delegate, contextViewService, contextKeyService, keybindingService) {
|
|
12
|
+
super({
|
|
13
|
+
showCommonFindToggles: false,
|
|
14
|
+
checkImeCompletionState: _delegate.checkImeCompletionState,
|
|
15
|
+
enableSash: true,
|
|
16
|
+
}, contextViewService, contextKeyService, keybindingService);
|
|
17
|
+
this._delegate = _delegate;
|
|
18
|
+
this._findWidgetFocused = KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED.bindTo(contextKeyService);
|
|
19
|
+
this._register(_delegate.hasFindResult(hasResult => {
|
|
20
|
+
this.updateButtons(hasResult);
|
|
21
|
+
this.focusFindBox();
|
|
22
|
+
}));
|
|
23
|
+
this._register(_delegate.onDidStopFind(() => {
|
|
24
|
+
this.updateButtons(false);
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
find(previous) {
|
|
28
|
+
const val = this.inputValue;
|
|
29
|
+
if (val) {
|
|
30
|
+
this._delegate.find(val, previous);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
hide(animated = true) {
|
|
34
|
+
super.hide(animated);
|
|
35
|
+
this._delegate.stopFind(true);
|
|
36
|
+
this._delegate.focus();
|
|
37
|
+
}
|
|
38
|
+
_onInputChanged() {
|
|
39
|
+
const val = this.inputValue;
|
|
40
|
+
if (val) {
|
|
41
|
+
this._delegate.updateFind(val);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
this._delegate.stopFind(false);
|
|
45
|
+
}
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
_onFocusTrackerFocus() {
|
|
49
|
+
this._findWidgetFocused.set(true);
|
|
50
|
+
}
|
|
51
|
+
_onFocusTrackerBlur() {
|
|
52
|
+
this._findWidgetFocused.reset();
|
|
53
|
+
}
|
|
54
|
+
_onFindInputFocusTrackerFocus() { }
|
|
55
|
+
_onFindInputFocusTrackerBlur() { }
|
|
56
|
+
findFirst() { }
|
|
57
|
+
};
|
|
58
|
+
WebviewFindWidget = ( __decorate([
|
|
59
|
+
( __param(1, IContextViewService)),
|
|
60
|
+
( __param(2, IContextKeyService)),
|
|
61
|
+
( __param(3, IKeybindingService))
|
|
62
|
+
], WebviewFindWidget));
|
|
63
|
+
export { WebviewFindWidget };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Emitter } from '../../../../base/common/event.js';
|
|
3
|
+
import { Disposable } from '../../../../base/common/lifecycle.js';
|
|
4
|
+
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
|
|
5
|
+
import { WebviewThemeDataProvider } from './themeing.js';
|
|
6
|
+
import { WebviewElement } from './webviewElement.js';
|
|
7
|
+
import { OverlayWebview } from './overlayWebview.js';
|
|
8
|
+
let WebviewService = class WebviewService extends Disposable {
|
|
9
|
+
constructor(_instantiationService) {
|
|
10
|
+
super();
|
|
11
|
+
this._instantiationService = _instantiationService;
|
|
12
|
+
this._webviews = ( new Set());
|
|
13
|
+
this._onDidChangeActiveWebview = this._register(( new Emitter()));
|
|
14
|
+
this.onDidChangeActiveWebview = this._onDidChangeActiveWebview.event;
|
|
15
|
+
this._webviewThemeDataProvider = this._instantiationService.createInstance(WebviewThemeDataProvider);
|
|
16
|
+
}
|
|
17
|
+
get activeWebview() { return this._activeWebview; }
|
|
18
|
+
_updateActiveWebview(value) {
|
|
19
|
+
if (value !== this._activeWebview) {
|
|
20
|
+
this._activeWebview = value;
|
|
21
|
+
this._onDidChangeActiveWebview.fire(value);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
get webviews() {
|
|
25
|
+
return ( this._webviews.values());
|
|
26
|
+
}
|
|
27
|
+
createWebviewElement(initInfo) {
|
|
28
|
+
const webview = this._instantiationService.createInstance(WebviewElement, initInfo, this._webviewThemeDataProvider);
|
|
29
|
+
this.registerNewWebview(webview);
|
|
30
|
+
return webview;
|
|
31
|
+
}
|
|
32
|
+
createWebviewOverlay(initInfo) {
|
|
33
|
+
const webview = this._instantiationService.createInstance(OverlayWebview, initInfo);
|
|
34
|
+
this.registerNewWebview(webview);
|
|
35
|
+
return webview;
|
|
36
|
+
}
|
|
37
|
+
registerNewWebview(webview) {
|
|
38
|
+
this._webviews.add(webview);
|
|
39
|
+
webview.onDidFocus(() => {
|
|
40
|
+
this._updateActiveWebview(webview);
|
|
41
|
+
});
|
|
42
|
+
const onBlur = () => {
|
|
43
|
+
if (this._activeWebview === webview) {
|
|
44
|
+
this._updateActiveWebview(undefined);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
webview.onDidBlur(onBlur);
|
|
48
|
+
webview.onDidDispose(() => {
|
|
49
|
+
onBlur();
|
|
50
|
+
this._webviews.delete(webview);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
WebviewService = ( __decorate([
|
|
55
|
+
( __param(0, IInstantiationService))
|
|
56
|
+
], WebviewService));
|
|
57
|
+
export { WebviewService };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { EditorContextKeys } from '../../../../editor/common/editorContextKeys.js';
|
|
2
|
+
import { localizeWithPath } from '../../../../nls.js';
|
|
3
|
+
import { Action2, MenuId } from '../../../../platform/actions/common/actions.js';
|
|
4
|
+
import { ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js';
|
|
5
|
+
import { Categories } from '../../../../platform/action/common/actionCommonCategories.js';
|
|
6
|
+
import { KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_ENABLED, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED, IWebviewService } from '../../webview/browser/webview.js';
|
|
7
|
+
import { WebviewEditor } from './webviewEditor.js';
|
|
8
|
+
import { WebviewInput } from './webviewEditorInput.js';
|
|
9
|
+
import { IEditorService } from '../../../services/editor/common/editorService.js';
|
|
10
|
+
const webviewActiveContextKeyExpr = ( ContextKeyExpr.and(( ContextKeyExpr.equals('activeEditor', WebviewEditor.ID)), ( EditorContextKeys.focus.toNegated() )));
|
|
11
|
+
class ShowWebViewEditorFindWidgetAction extends Action2 {
|
|
12
|
+
static { this.ID = 'editor.action.webvieweditor.showFind'; }
|
|
13
|
+
static { this.LABEL = ( localizeWithPath(
|
|
14
|
+
'vs/workbench/contrib/webviewPanel/browser/webviewCommands',
|
|
15
|
+
'editor.action.webvieweditor.showFind',
|
|
16
|
+
"Show find"
|
|
17
|
+
)); }
|
|
18
|
+
constructor() {
|
|
19
|
+
super({
|
|
20
|
+
id: ShowWebViewEditorFindWidgetAction.ID,
|
|
21
|
+
title: ShowWebViewEditorFindWidgetAction.LABEL,
|
|
22
|
+
keybinding: {
|
|
23
|
+
when: ( ContextKeyExpr.and(
|
|
24
|
+
webviewActiveContextKeyExpr,
|
|
25
|
+
KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_ENABLED
|
|
26
|
+
)),
|
|
27
|
+
primary: 2048 | 36 ,
|
|
28
|
+
weight: 100
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
run(accessor) {
|
|
33
|
+
getActiveWebviewEditor(accessor)?.showFind();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
class HideWebViewEditorFindCommand extends Action2 {
|
|
37
|
+
static { this.ID = 'editor.action.webvieweditor.hideFind'; }
|
|
38
|
+
static { this.LABEL = ( localizeWithPath(
|
|
39
|
+
'vs/workbench/contrib/webviewPanel/browser/webviewCommands',
|
|
40
|
+
'editor.action.webvieweditor.hideFind',
|
|
41
|
+
"Stop find"
|
|
42
|
+
)); }
|
|
43
|
+
constructor() {
|
|
44
|
+
super({
|
|
45
|
+
id: HideWebViewEditorFindCommand.ID,
|
|
46
|
+
title: HideWebViewEditorFindCommand.LABEL,
|
|
47
|
+
keybinding: {
|
|
48
|
+
when: ( ContextKeyExpr.and(
|
|
49
|
+
webviewActiveContextKeyExpr,
|
|
50
|
+
KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE
|
|
51
|
+
)),
|
|
52
|
+
primary: 9 ,
|
|
53
|
+
weight: 100
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
run(accessor) {
|
|
58
|
+
getActiveWebviewEditor(accessor)?.hideFind();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
class WebViewEditorFindNextCommand extends Action2 {
|
|
62
|
+
static { this.ID = 'editor.action.webvieweditor.findNext'; }
|
|
63
|
+
static { this.LABEL = ( localizeWithPath(
|
|
64
|
+
'vs/workbench/contrib/webviewPanel/browser/webviewCommands',
|
|
65
|
+
'editor.action.webvieweditor.findNext',
|
|
66
|
+
'Find next'
|
|
67
|
+
)); }
|
|
68
|
+
constructor() {
|
|
69
|
+
super({
|
|
70
|
+
id: WebViewEditorFindNextCommand.ID,
|
|
71
|
+
title: WebViewEditorFindNextCommand.LABEL,
|
|
72
|
+
keybinding: {
|
|
73
|
+
when: ( ContextKeyExpr.and(
|
|
74
|
+
webviewActiveContextKeyExpr,
|
|
75
|
+
KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED
|
|
76
|
+
)),
|
|
77
|
+
primary: 3 ,
|
|
78
|
+
weight: 100
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
run(accessor) {
|
|
83
|
+
getActiveWebviewEditor(accessor)?.runFindAction(false);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
class WebViewEditorFindPreviousCommand extends Action2 {
|
|
87
|
+
static { this.ID = 'editor.action.webvieweditor.findPrevious'; }
|
|
88
|
+
static { this.LABEL = ( localizeWithPath(
|
|
89
|
+
'vs/workbench/contrib/webviewPanel/browser/webviewCommands',
|
|
90
|
+
'editor.action.webvieweditor.findPrevious',
|
|
91
|
+
'Find previous'
|
|
92
|
+
)); }
|
|
93
|
+
constructor() {
|
|
94
|
+
super({
|
|
95
|
+
id: WebViewEditorFindPreviousCommand.ID,
|
|
96
|
+
title: WebViewEditorFindPreviousCommand.LABEL,
|
|
97
|
+
keybinding: {
|
|
98
|
+
when: ( ContextKeyExpr.and(
|
|
99
|
+
webviewActiveContextKeyExpr,
|
|
100
|
+
KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED
|
|
101
|
+
)),
|
|
102
|
+
primary: 1024 | 3 ,
|
|
103
|
+
weight: 100
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
run(accessor) {
|
|
108
|
+
getActiveWebviewEditor(accessor)?.runFindAction(true);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
class ReloadWebviewAction extends Action2 {
|
|
112
|
+
static { this.ID = 'workbench.action.webview.reloadWebviewAction'; }
|
|
113
|
+
static { this.LABEL = ( localizeWithPath(
|
|
114
|
+
'vs/workbench/contrib/webviewPanel/browser/webviewCommands',
|
|
115
|
+
'refreshWebviewLabel',
|
|
116
|
+
"Reload Webviews"
|
|
117
|
+
)); }
|
|
118
|
+
constructor() {
|
|
119
|
+
super({
|
|
120
|
+
id: ReloadWebviewAction.ID,
|
|
121
|
+
title: { value: ReloadWebviewAction.LABEL, original: 'Reload Webviews' },
|
|
122
|
+
category: Categories.Developer,
|
|
123
|
+
menu: [{
|
|
124
|
+
id: MenuId.CommandPalette
|
|
125
|
+
}]
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
async run(accessor) {
|
|
129
|
+
const webviewService = accessor.get(IWebviewService);
|
|
130
|
+
for (const webview of webviewService.webviews) {
|
|
131
|
+
webview.reload();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function getActiveWebviewEditor(accessor) {
|
|
136
|
+
const editorService = accessor.get(IEditorService);
|
|
137
|
+
const activeEditor = editorService.activeEditor;
|
|
138
|
+
return activeEditor instanceof WebviewInput ? activeEditor.webview : undefined;
|
|
139
|
+
}
|
|
140
|
+
export { HideWebViewEditorFindCommand, ReloadWebviewAction, ShowWebViewEditorFindWidgetAction, WebViewEditorFindNextCommand, WebViewEditorFindPreviousCommand };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { URI } from '../../../../base/common/uri.js';
|
|
3
|
+
import { ExtensionIdentifier } from '../../../../platform/extensions/common/extensions.js';
|
|
4
|
+
import { WebviewInput } from './webviewEditorInput.js';
|
|
5
|
+
import { IWebviewWorkbenchService } from './webviewWorkbenchService.js';
|
|
6
|
+
let WebviewEditorInputSerializer = class WebviewEditorInputSerializer {
|
|
7
|
+
static { this.ID = WebviewInput.typeId; }
|
|
8
|
+
constructor(_webviewWorkbenchService) {
|
|
9
|
+
this._webviewWorkbenchService = _webviewWorkbenchService;
|
|
10
|
+
}
|
|
11
|
+
canSerialize(input) {
|
|
12
|
+
return this._webviewWorkbenchService.shouldPersist(input);
|
|
13
|
+
}
|
|
14
|
+
serialize(input) {
|
|
15
|
+
if (!this._webviewWorkbenchService.shouldPersist(input)) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
const data = this.toJson(input);
|
|
19
|
+
try {
|
|
20
|
+
return JSON.stringify(data);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
deserialize(_instantiationService, serializedEditorInput) {
|
|
27
|
+
const data = this.fromJson(JSON.parse(serializedEditorInput));
|
|
28
|
+
return this._webviewWorkbenchService.openRevivedWebview({
|
|
29
|
+
webviewInitInfo: {
|
|
30
|
+
providedViewType: data.providedId,
|
|
31
|
+
origin: data.origin,
|
|
32
|
+
title: data.title,
|
|
33
|
+
options: data.webviewOptions,
|
|
34
|
+
contentOptions: data.contentOptions,
|
|
35
|
+
extension: data.extension,
|
|
36
|
+
},
|
|
37
|
+
viewType: data.viewType,
|
|
38
|
+
title: data.title,
|
|
39
|
+
iconPath: data.iconPath,
|
|
40
|
+
state: data.state,
|
|
41
|
+
group: data.group
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
fromJson(data) {
|
|
45
|
+
return {
|
|
46
|
+
...data,
|
|
47
|
+
extension: reviveWebviewExtensionDescription(data.extensionId, data.extensionLocation),
|
|
48
|
+
iconPath: reviveIconPath(data.iconPath),
|
|
49
|
+
state: reviveState(data.state),
|
|
50
|
+
webviewOptions: restoreWebviewOptions(data.options),
|
|
51
|
+
contentOptions: restoreWebviewContentOptions(data.options),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
toJson(input) {
|
|
55
|
+
return {
|
|
56
|
+
origin: input.webview.origin,
|
|
57
|
+
viewType: input.viewType,
|
|
58
|
+
providedId: input.providedId,
|
|
59
|
+
title: input.getName(),
|
|
60
|
+
options: { ...input.webview.options, ...input.webview.contentOptions },
|
|
61
|
+
extensionLocation: input.extension?.location,
|
|
62
|
+
extensionId: input.extension?.id.value,
|
|
63
|
+
state: input.webview.state,
|
|
64
|
+
iconPath: input.iconPath ? { light: input.iconPath.light, dark: input.iconPath.dark, } : undefined,
|
|
65
|
+
group: input.group
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
WebviewEditorInputSerializer = ( __decorate([
|
|
70
|
+
( __param(0, IWebviewWorkbenchService))
|
|
71
|
+
], WebviewEditorInputSerializer));
|
|
72
|
+
function reviveWebviewExtensionDescription(extensionId, extensionLocation) {
|
|
73
|
+
if (!extensionId) {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
const location = reviveUri(extensionLocation);
|
|
77
|
+
if (!location) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
id: ( new ExtensionIdentifier(extensionId)),
|
|
82
|
+
location,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function reviveIconPath(data) {
|
|
86
|
+
if (!data) {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
const light = reviveUri(data.light);
|
|
90
|
+
const dark = reviveUri(data.dark);
|
|
91
|
+
return light && dark ? { light, dark } : undefined;
|
|
92
|
+
}
|
|
93
|
+
function reviveUri(data) {
|
|
94
|
+
if (!data) {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
if (typeof data === 'string') {
|
|
99
|
+
return ( URI.parse(data));
|
|
100
|
+
}
|
|
101
|
+
return ( URI.from(data));
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function reviveState(state) {
|
|
108
|
+
return typeof state === 'string' ? state : undefined;
|
|
109
|
+
}
|
|
110
|
+
function restoreWebviewOptions(options) {
|
|
111
|
+
return options;
|
|
112
|
+
}
|
|
113
|
+
function restoreWebviewContentOptions(options) {
|
|
114
|
+
return {
|
|
115
|
+
...options,
|
|
116
|
+
localResourceRoots: options.localResourceRoots?.map(uri => reviveUri(uri)),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export { WebviewEditorInputSerializer, restoreWebviewContentOptions, restoreWebviewOptions, reviveWebviewExtensionDescription };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Event } from '../../../../base/common/event.js';
|
|
3
|
+
import { Disposable } from '../../../../base/common/lifecycle.js';
|
|
4
|
+
import { localizeWithPath } from '../../../../nls.js';
|
|
5
|
+
import { registerAction2 } from '../../../../platform/actions/common/actions.js';
|
|
6
|
+
import { SyncDescriptor } from '../../../../platform/instantiation/common/descriptors.js';
|
|
7
|
+
import { Registry } from '../../../../platform/registry/common/platform.js';
|
|
8
|
+
import { EditorPaneDescriptor } from '../../../browser/editor.js';
|
|
9
|
+
import { Extensions } from '../../../common/contributions.js';
|
|
10
|
+
import { EditorExtensions } from '../../../common/editor.js';
|
|
11
|
+
import { IEditorGroupsService } from '../../../services/editor/common/editorGroupsService.js';
|
|
12
|
+
import { ShowWebViewEditorFindWidgetAction, HideWebViewEditorFindCommand, WebViewEditorFindNextCommand, WebViewEditorFindPreviousCommand, ReloadWebviewAction } from './webviewCommands.js';
|
|
13
|
+
import { WebviewEditor } from './webviewEditor.js';
|
|
14
|
+
import { WebviewInput } from './webviewEditorInput.js';
|
|
15
|
+
import { WebviewEditorInputSerializer } from './webviewEditorInputSerializer.js';
|
|
16
|
+
(( Registry.as(EditorExtensions.EditorPane))).registerEditorPane(EditorPaneDescriptor.create(WebviewEditor, WebviewEditor.ID, ( localizeWithPath(
|
|
17
|
+
'vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution',
|
|
18
|
+
'webview.editor.label',
|
|
19
|
+
"webview editor"
|
|
20
|
+
))), [( new SyncDescriptor(WebviewInput))]);
|
|
21
|
+
let WebviewPanelContribution = class WebviewPanelContribution extends Disposable {
|
|
22
|
+
constructor(editorGroupService) {
|
|
23
|
+
super();
|
|
24
|
+
this.editorGroupService = editorGroupService;
|
|
25
|
+
this.editorGroupService.whenReady.then(() => this.editorGroupService.groups.forEach(group => {
|
|
26
|
+
this.registerGroupListener(group);
|
|
27
|
+
}));
|
|
28
|
+
this._register(this.editorGroupService.onDidAddGroup(group => this.registerGroupListener(group)));
|
|
29
|
+
}
|
|
30
|
+
registerGroupListener(group) {
|
|
31
|
+
const listener = group.onWillOpenEditor(e => this.onEditorOpening(e.editor, group));
|
|
32
|
+
Event.once(group.onWillDispose)(() => {
|
|
33
|
+
listener.dispose();
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
onEditorOpening(editor, group) {
|
|
37
|
+
if (!(editor instanceof WebviewInput) || editor.typeId !== WebviewInput.typeId) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
if (group.contains(editor)) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
let previousGroup;
|
|
44
|
+
const groups = this.editorGroupService.groups;
|
|
45
|
+
for (const group of groups) {
|
|
46
|
+
if (group.contains(editor)) {
|
|
47
|
+
previousGroup = group;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (!previousGroup) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
previousGroup.closeEditor(editor);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
WebviewPanelContribution = ( __decorate([
|
|
58
|
+
( __param(0, IEditorGroupsService))
|
|
59
|
+
], WebviewPanelContribution));
|
|
60
|
+
const workbenchContributionsRegistry = ( Registry.as(Extensions.Workbench));
|
|
61
|
+
workbenchContributionsRegistry.registerWorkbenchContribution(WebviewPanelContribution, 1 );
|
|
62
|
+
( Registry.as(EditorExtensions.EditorFactory)).registerEditorSerializer(WebviewEditorInputSerializer.ID, WebviewEditorInputSerializer);
|
|
63
|
+
registerAction2(ShowWebViewEditorFindWidgetAction);
|
|
64
|
+
registerAction2(HideWebViewEditorFindCommand);
|
|
65
|
+
registerAction2(WebViewEditorFindNextCommand);
|
|
66
|
+
registerAction2(WebViewEditorFindPreviousCommand);
|
|
67
|
+
registerAction2(ReloadWebviewAction);
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Dimension, EventType, addDisposableListener, findParentWithClass } from '../../../../base/browser/dom.js';
|
|
3
|
+
import { CancellationTokenSource } from '../../../../base/common/cancellation.js';
|
|
4
|
+
import { Emitter } from '../../../../base/common/event.js';
|
|
5
|
+
import { MutableDisposable, DisposableStore, toDisposable } from '../../../../base/common/lifecycle.js';
|
|
6
|
+
import { MenuId } from '../../../../platform/actions/common/actions.js';
|
|
7
|
+
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
|
|
8
|
+
import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
|
|
9
|
+
import { IContextMenuService } from '../../../../platform/contextview/browser/contextView.js';
|
|
10
|
+
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
|
|
11
|
+
import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js';
|
|
12
|
+
import { IOpenerService } from '../../../../platform/opener/common/opener.js';
|
|
13
|
+
import { IProgressService } from '../../../../platform/progress/common/progress.js';
|
|
14
|
+
import { IStorageService } from '../../../../platform/storage/common/storage.js';
|
|
15
|
+
import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.js';
|
|
16
|
+
import { IThemeService } from '../../../../platform/theme/common/themeService.js';
|
|
17
|
+
import { ViewPane, ViewPaneShowActions } from '../../../browser/parts/views/viewPane.js';
|
|
18
|
+
import { Memento } from '../../../common/memento.js';
|
|
19
|
+
import { IViewDescriptorService } from '../../../common/views.js';
|
|
20
|
+
import { IViewsService } from '../../../services/views/common/viewsService.js';
|
|
21
|
+
import { ExtensionKeyedWebviewOriginStore, IWebviewService } from '../../webview/browser/webview.js';
|
|
22
|
+
import { WebviewWindowDragMonitor } from '../../webview/browser/webviewWindowDragMonitor.js';
|
|
23
|
+
import { IWebviewViewService } from './webviewViewService.js';
|
|
24
|
+
import { IActivityService, NumberBadge } from '../../../services/activity/common/activity.js';
|
|
25
|
+
import { IExtensionService } from '../../../services/extensions/common/extensions.js';
|
|
26
|
+
var WebviewViewPane_1;
|
|
27
|
+
const storageKeys = {
|
|
28
|
+
webviewState: 'webviewState',
|
|
29
|
+
};
|
|
30
|
+
let WebviewViewPane = class WebviewViewPane extends ViewPane {
|
|
31
|
+
static { WebviewViewPane_1 = this; }
|
|
32
|
+
static getOriginStore(storageService) {
|
|
33
|
+
this._originStore ??= ( new ExtensionKeyedWebviewOriginStore('webviewViews.origins', storageService));
|
|
34
|
+
return this._originStore;
|
|
35
|
+
}
|
|
36
|
+
constructor(options, configurationService, contextKeyService, contextMenuService, instantiationService, keybindingService, openerService, telemetryService, themeService, viewDescriptorService, activityService, extensionService, progressService, storageService, viewService, webviewService, webviewViewService) {
|
|
37
|
+
super({ ...options, titleMenuId: MenuId.ViewTitle, showActions: ViewPaneShowActions.WhenExpanded }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
|
|
38
|
+
this.activityService = activityService;
|
|
39
|
+
this.extensionService = extensionService;
|
|
40
|
+
this.progressService = progressService;
|
|
41
|
+
this.storageService = storageService;
|
|
42
|
+
this.viewService = viewService;
|
|
43
|
+
this.webviewService = webviewService;
|
|
44
|
+
this.webviewViewService = webviewViewService;
|
|
45
|
+
this._webview = this._register(( new MutableDisposable()));
|
|
46
|
+
this._webviewDisposables = this._register(( new DisposableStore()));
|
|
47
|
+
this._activated = false;
|
|
48
|
+
this._onDidChangeVisibility = this._register(( new Emitter()));
|
|
49
|
+
this.onDidChangeVisibility = this._onDidChangeVisibility.event;
|
|
50
|
+
this._onDispose = this._register(( new Emitter()));
|
|
51
|
+
this.onDispose = this._onDispose.event;
|
|
52
|
+
this.extensionId = options.fromExtensionId;
|
|
53
|
+
this.defaultTitle = this.title;
|
|
54
|
+
this.memento = ( new Memento(`webviewView.${this.id}`, storageService));
|
|
55
|
+
this.viewState = this.memento.getMemento(1 , 1 );
|
|
56
|
+
this._register(this.onDidChangeBodyVisibility(() => this.updateTreeVisibility()));
|
|
57
|
+
this._register(this.webviewViewService.onNewResolverRegistered(e => {
|
|
58
|
+
if (e.viewType === this.id) {
|
|
59
|
+
this.updateTreeVisibility();
|
|
60
|
+
}
|
|
61
|
+
}));
|
|
62
|
+
this.updateTreeVisibility();
|
|
63
|
+
}
|
|
64
|
+
dispose() {
|
|
65
|
+
this._onDispose.fire();
|
|
66
|
+
clearTimeout(this._repositionTimeout);
|
|
67
|
+
super.dispose();
|
|
68
|
+
}
|
|
69
|
+
focus() {
|
|
70
|
+
super.focus();
|
|
71
|
+
this._webview.value?.focus();
|
|
72
|
+
}
|
|
73
|
+
renderBody(container) {
|
|
74
|
+
super.renderBody(container);
|
|
75
|
+
this._container = container;
|
|
76
|
+
this._rootContainer = undefined;
|
|
77
|
+
if (!this._resizeObserver) {
|
|
78
|
+
this._resizeObserver = ( new ResizeObserver(() => {
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
this.layoutWebview();
|
|
81
|
+
}, 0);
|
|
82
|
+
}));
|
|
83
|
+
this._register(toDisposable(() => {
|
|
84
|
+
this._resizeObserver.disconnect();
|
|
85
|
+
}));
|
|
86
|
+
this._resizeObserver.observe(container);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
saveState() {
|
|
90
|
+
if (this._webview.value) {
|
|
91
|
+
this.viewState[storageKeys.webviewState] = this._webview.value.state;
|
|
92
|
+
}
|
|
93
|
+
this.memento.saveMemento();
|
|
94
|
+
super.saveState();
|
|
95
|
+
}
|
|
96
|
+
layoutBody(height, width) {
|
|
97
|
+
super.layoutBody(height, width);
|
|
98
|
+
this.layoutWebview(( new Dimension(width, height)));
|
|
99
|
+
}
|
|
100
|
+
updateTreeVisibility() {
|
|
101
|
+
if (this.isBodyVisible()) {
|
|
102
|
+
this.activate();
|
|
103
|
+
this._webview.value?.claim(this, undefined);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
this._webview.value?.release(this);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
activate() {
|
|
110
|
+
if (this._activated) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
this._activated = true;
|
|
114
|
+
const origin = this.extensionId ? WebviewViewPane_1.getOriginStore(this.storageService).getOrigin(this.id, this.extensionId) : undefined;
|
|
115
|
+
const webview = this.webviewService.createWebviewOverlay({
|
|
116
|
+
origin,
|
|
117
|
+
providedViewType: this.id,
|
|
118
|
+
title: this.title,
|
|
119
|
+
options: { purpose: "webviewView" },
|
|
120
|
+
contentOptions: {},
|
|
121
|
+
extension: this.extensionId ? { id: this.extensionId } : undefined
|
|
122
|
+
});
|
|
123
|
+
webview.state = this.viewState[storageKeys.webviewState];
|
|
124
|
+
this._webview.value = webview;
|
|
125
|
+
if (this._container) {
|
|
126
|
+
this.layoutWebview();
|
|
127
|
+
}
|
|
128
|
+
this._webviewDisposables.add(toDisposable(() => {
|
|
129
|
+
this._webview.value?.release(this);
|
|
130
|
+
}));
|
|
131
|
+
this._webviewDisposables.add(webview.onDidUpdateState(() => {
|
|
132
|
+
this.viewState[storageKeys.webviewState] = webview.state;
|
|
133
|
+
}));
|
|
134
|
+
for (const event of [EventType.DRAG, EventType.DRAG_END, EventType.DRAG_ENTER, EventType.DRAG_LEAVE, EventType.DRAG_START]) {
|
|
135
|
+
this._webviewDisposables.add(addDisposableListener(this._webview.value.container, event, e => {
|
|
136
|
+
e.preventDefault();
|
|
137
|
+
e.stopImmediatePropagation();
|
|
138
|
+
this.dropTargetElement.dispatchEvent(( new DragEvent(e.type, e)));
|
|
139
|
+
}));
|
|
140
|
+
}
|
|
141
|
+
this._webviewDisposables.add(( new WebviewWindowDragMonitor(() => this._webview.value)));
|
|
142
|
+
const source = this._webviewDisposables.add(( new CancellationTokenSource()));
|
|
143
|
+
this.withProgress(async () => {
|
|
144
|
+
await this.extensionService.activateByEvent(`onView:${this.id}`);
|
|
145
|
+
const self = this;
|
|
146
|
+
const webviewView = {
|
|
147
|
+
webview,
|
|
148
|
+
onDidChangeVisibility: this.onDidChangeBodyVisibility,
|
|
149
|
+
onDispose: this.onDispose,
|
|
150
|
+
get title() { return self.setTitle; },
|
|
151
|
+
set title(value) { self.updateTitle(value); },
|
|
152
|
+
get description() { return self.titleDescription; },
|
|
153
|
+
set description(value) { self.updateTitleDescription(value); },
|
|
154
|
+
get badge() { return self.badge; },
|
|
155
|
+
set badge(badge) { self.updateBadge(badge); },
|
|
156
|
+
dispose: () => {
|
|
157
|
+
this._activated = false;
|
|
158
|
+
this._webview.clear();
|
|
159
|
+
this._webviewDisposables.clear();
|
|
160
|
+
},
|
|
161
|
+
show: (preserveFocus) => {
|
|
162
|
+
this.viewService.openView(this.id, !preserveFocus);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
await this.webviewViewService.resolve(this.id, webviewView, source.token);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
updateTitle(value) {
|
|
169
|
+
this.setTitle = value;
|
|
170
|
+
super.updateTitle(typeof value === 'string' ? value : this.defaultTitle);
|
|
171
|
+
}
|
|
172
|
+
updateBadge(badge) {
|
|
173
|
+
if (this.badge?.value === badge?.value &&
|
|
174
|
+
this.badge?.tooltip === badge?.tooltip) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (this.activity) {
|
|
178
|
+
this.activity.dispose();
|
|
179
|
+
this.activity = undefined;
|
|
180
|
+
}
|
|
181
|
+
this.badge = badge;
|
|
182
|
+
if (badge) {
|
|
183
|
+
const activity = {
|
|
184
|
+
badge: ( new NumberBadge(badge.value, () => badge.tooltip)),
|
|
185
|
+
priority: 150
|
|
186
|
+
};
|
|
187
|
+
this.activityService.showViewActivity(this.id, activity);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
async withProgress(task) {
|
|
191
|
+
return this.progressService.withProgress({ location: this.id, delay: 500 }, task);
|
|
192
|
+
}
|
|
193
|
+
onDidScrollRoot() {
|
|
194
|
+
this.layoutWebview();
|
|
195
|
+
}
|
|
196
|
+
doLayoutWebview(dimension) {
|
|
197
|
+
const webviewEntry = this._webview.value;
|
|
198
|
+
if (!this._container || !webviewEntry) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (!this._rootContainer || !this._rootContainer.isConnected) {
|
|
202
|
+
this._rootContainer = this.findRootContainer(this._container);
|
|
203
|
+
}
|
|
204
|
+
webviewEntry.layoutWebviewOverElement(this._container, dimension, this._rootContainer);
|
|
205
|
+
}
|
|
206
|
+
layoutWebview(dimension) {
|
|
207
|
+
this.doLayoutWebview(dimension);
|
|
208
|
+
clearTimeout(this._repositionTimeout);
|
|
209
|
+
this._repositionTimeout = setTimeout(() => this.doLayoutWebview(dimension), 200);
|
|
210
|
+
}
|
|
211
|
+
findRootContainer(container) {
|
|
212
|
+
return findParentWithClass(container, 'monaco-scrollable-element') ?? undefined;
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
WebviewViewPane = WebviewViewPane_1 = ( __decorate([
|
|
216
|
+
( __param(1, IConfigurationService)),
|
|
217
|
+
( __param(2, IContextKeyService)),
|
|
218
|
+
( __param(3, IContextMenuService)),
|
|
219
|
+
( __param(4, IInstantiationService)),
|
|
220
|
+
( __param(5, IKeybindingService)),
|
|
221
|
+
( __param(6, IOpenerService)),
|
|
222
|
+
( __param(7, ITelemetryService)),
|
|
223
|
+
( __param(8, IThemeService)),
|
|
224
|
+
( __param(9, IViewDescriptorService)),
|
|
225
|
+
( __param(10, IActivityService)),
|
|
226
|
+
( __param(11, IExtensionService)),
|
|
227
|
+
( __param(12, IProgressService)),
|
|
228
|
+
( __param(13, IStorageService)),
|
|
229
|
+
( __param(14, IViewsService)),
|
|
230
|
+
( __param(15, IWebviewService)),
|
|
231
|
+
( __param(16, IWebviewViewService))
|
|
232
|
+
], WebviewViewPane));
|
|
233
|
+
export { WebviewViewPane };
|