@opensumi/ide-webview 2.12.1-next-079c1930
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/lib/browser/abstract-webview.d.ts +57 -0
- package/lib/browser/abstract-webview.d.ts.map +1 -0
- package/lib/browser/abstract-webview.js +167 -0
- package/lib/browser/abstract-webview.js.map +1 -0
- package/lib/browser/contribution.d.ts +11 -0
- package/lib/browser/contribution.d.ts.map +1 -0
- package/lib/browser/contribution.js +85 -0
- package/lib/browser/contribution.js.map +1 -0
- package/lib/browser/editor-webview.d.ts +24 -0
- package/lib/browser/editor-webview.d.ts.map +1 -0
- package/lib/browser/editor-webview.js +167 -0
- package/lib/browser/editor-webview.js.map +1 -0
- package/lib/browser/electron-webview-webview.d.ts +21 -0
- package/lib/browser/electron-webview-webview.d.ts.map +1 -0
- package/lib/browser/electron-webview-webview.js +137 -0
- package/lib/browser/electron-webview-webview.js.map +1 -0
- package/lib/browser/iframe-webview.d.ts +21 -0
- package/lib/browser/iframe-webview.d.ts.map +1 -0
- package/lib/browser/iframe-webview.js +118 -0
- package/lib/browser/iframe-webview.js.map +1 -0
- package/lib/browser/index.d.ts +8 -0
- package/lib/browser/index.d.ts.map +1 -0
- package/lib/browser/index.js +29 -0
- package/lib/browser/index.js.map +1 -0
- package/lib/browser/plain-webview.d.ts +45 -0
- package/lib/browser/plain-webview.d.ts.map +1 -0
- package/lib/browser/plain-webview.js +199 -0
- package/lib/browser/plain-webview.js.map +1 -0
- package/lib/browser/types.d.ts +171 -0
- package/lib/browser/types.d.ts.map +1 -0
- package/lib/browser/types.js +10 -0
- package/lib/browser/types.js.map +1 -0
- package/lib/browser/webview-window.d.ts +33 -0
- package/lib/browser/webview-window.d.ts.map +1 -0
- package/lib/browser/webview-window.js +104 -0
- package/lib/browser/webview-window.js.map +1 -0
- package/lib/browser/webview.service.d.ts +76 -0
- package/lib/browser/webview.service.d.ts.map +1 -0
- package/lib/browser/webview.service.js +380 -0
- package/lib/browser/webview.service.js.map +1 -0
- package/lib/common/index.d.ts +2 -0
- package/lib/common/index.d.ts.map +1 -0
- package/lib/common/index.js +5 -0
- package/lib/common/index.js.map +1 -0
- package/lib/electron-main/index.d.ts +9 -0
- package/lib/electron-main/index.d.ts.map +1 -0
- package/lib/electron-main/index.js +41 -0
- package/lib/electron-main/index.js.map +1 -0
- package/lib/electron-webview/host-channel.d.ts +13 -0
- package/lib/electron-webview/host-channel.d.ts.map +1 -0
- package/lib/electron-webview/host-channel.js +57 -0
- package/lib/electron-webview/host-channel.js.map +1 -0
- package/lib/electron-webview/host-preload.js +2 -0
- package/lib/electron-webview/plain-preload.js +55 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -0
- package/lib/webview-host/common.d.ts +12 -0
- package/lib/webview-host/common.d.ts.map +1 -0
- package/lib/webview-host/common.js +97 -0
- package/lib/webview-host/common.js.map +1 -0
- package/lib/webview-host/web-preload.d.ts +16 -0
- package/lib/webview-host/web-preload.d.ts.map +1 -0
- package/lib/webview-host/web-preload.js +69 -0
- package/lib/webview-host/web-preload.js.map +1 -0
- package/lib/webview-host/webview-manager.d.ts +26 -0
- package/lib/webview-host/webview-manager.d.ts.map +1 -0
- package/lib/webview-host/webview-manager.js +314 -0
- package/lib/webview-host/webview-manager.js.map +1 -0
- package/lib/webview-host/webview.html +14 -0
- package/package.json +35 -0
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlainWebviewComponent = exports.EditorWebviewComponent = exports.WebviewServiceImpl = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const types_1 = require("./types");
|
|
6
|
+
const ide_core_browser_1 = require("@opensumi/ide-core-browser");
|
|
7
|
+
const plain_webview_1 = require("./plain-webview");
|
|
8
|
+
const di_1 = require("@opensumi/di");
|
|
9
|
+
const iframe_webview_1 = require("./iframe-webview");
|
|
10
|
+
const color_registry_1 = require("@opensumi/ide-theme/lib/common/color-registry");
|
|
11
|
+
const ide_editor_1 = require("@opensumi/ide-editor");
|
|
12
|
+
const browser_1 = require("@opensumi/ide-editor/lib/browser");
|
|
13
|
+
const editor_webview_1 = require("./editor-webview");
|
|
14
|
+
const electron_webview_webview_1 = require("./electron-webview-webview");
|
|
15
|
+
const webview_window_1 = require("./webview-window");
|
|
16
|
+
let WebviewServiceImpl = class WebviewServiceImpl {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.webviewIdCount = 0;
|
|
19
|
+
this.editorWebviewIdCount = 0;
|
|
20
|
+
this.editorWebviewComponents = new Map();
|
|
21
|
+
this.plainWebviewsComponents = new Map();
|
|
22
|
+
this.webviews = new Map();
|
|
23
|
+
this._revivers = [];
|
|
24
|
+
this.storage = this.getStorage(new ide_core_browser_1.URI('editor-webview').withScheme(ide_core_browser_1.STORAGE_SCHEMA.SCOPE));
|
|
25
|
+
}
|
|
26
|
+
async tryReviveWebviewComponent(id) {
|
|
27
|
+
if (this._revivers.length > 0) {
|
|
28
|
+
let targetReviver;
|
|
29
|
+
for (const reviver of this._revivers) {
|
|
30
|
+
try {
|
|
31
|
+
const weight = await reviver.handles(id);
|
|
32
|
+
if (weight >= 0 && (!targetReviver || targetReviver.weight < weight)) {
|
|
33
|
+
targetReviver = {
|
|
34
|
+
weight,
|
|
35
|
+
reviver,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
this.logger.error(e);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (targetReviver) {
|
|
44
|
+
try {
|
|
45
|
+
await targetReviver.reviver.revive(id);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
this.logger.error(e);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
throw new Error('Cannot revive webview ' + id);
|
|
54
|
+
}
|
|
55
|
+
registerWebviewReviver(reviver) {
|
|
56
|
+
return (0, ide_core_browser_1.addElement)(this._revivers, reviver);
|
|
57
|
+
}
|
|
58
|
+
createPlainWebview(options = {}) {
|
|
59
|
+
if ((0, ide_core_browser_1.isElectronRenderer)()) {
|
|
60
|
+
if (options.preferredImpl && options.preferredImpl === 'iframe') {
|
|
61
|
+
return new plain_webview_1.IframePlainWebview();
|
|
62
|
+
}
|
|
63
|
+
return new plain_webview_1.ElectronPlainWebview();
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
if (options.preferredImpl && options.preferredImpl === 'webview') {
|
|
67
|
+
(0, ide_core_browser_1.getDebugLogger)().warn((0, ide_core_browser_1.localize)('webview.webviewTagUnavailable', '无法在非Electron环境使用Webview标签。回退至使用iframe。'));
|
|
68
|
+
}
|
|
69
|
+
return new plain_webview_1.IframePlainWebview();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
createWebview(options) {
|
|
73
|
+
let webview;
|
|
74
|
+
if ((0, ide_core_browser_1.isElectronRenderer)()) {
|
|
75
|
+
webview = this.injector.get(electron_webview_webview_1.ElectronWebviewWebviewPanel, [(this.webviewIdCount++).toString(), options]);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
webview = this.injector.get(iframe_webview_1.IFrameWebviewPanel, [(this.webviewIdCount++).toString(), options]);
|
|
79
|
+
}
|
|
80
|
+
this.webviews.set(webview.id, webview);
|
|
81
|
+
webview.onRemove(() => {
|
|
82
|
+
this.webviews.delete(webview.id);
|
|
83
|
+
});
|
|
84
|
+
return webview;
|
|
85
|
+
}
|
|
86
|
+
getWebview(id) {
|
|
87
|
+
return this.webviews.get(id);
|
|
88
|
+
}
|
|
89
|
+
async storeWebviewResource(id) {
|
|
90
|
+
return this.storage.then((storage) => {
|
|
91
|
+
if (this.editorWebviewComponents.has(id)) {
|
|
92
|
+
const res = Object.assign({}, this.editorWebviewComponents.get(id).resource);
|
|
93
|
+
storage.set(id, JSON.stringify(res));
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
storage.delete(id);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
async tryRestoredWebviewComponent(id) {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
const storage = await this.storage;
|
|
103
|
+
const resource = storage.get(id) ? JSON.parse(storage.get(id)) : null;
|
|
104
|
+
if (resource) {
|
|
105
|
+
const component = this.createEditorWebviewComponent((_a = resource.metadata) === null || _a === void 0 ? void 0 : _a.options, (_b = resource.metadata) === null || _b === void 0 ? void 0 : _b.id);
|
|
106
|
+
component.title = resource.name;
|
|
107
|
+
component.supportsRevive = !!resource.supportsRevive;
|
|
108
|
+
this.tryReviveWebviewComponent(id);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
createEditorWebviewComponent(options, id) {
|
|
112
|
+
if (!id) {
|
|
113
|
+
id = (this.editorWebviewIdCount++).toString();
|
|
114
|
+
}
|
|
115
|
+
if (this.editorWebviewComponents.has(id)) {
|
|
116
|
+
return this.editorWebviewComponents.get(id);
|
|
117
|
+
}
|
|
118
|
+
const component = this.injector.get(EditorWebviewComponent, [id, () => this.createWebview(options)]);
|
|
119
|
+
this.editorWebviewComponents.set(id, component);
|
|
120
|
+
component.addDispose({
|
|
121
|
+
dispose: () => {
|
|
122
|
+
this.editorWebviewComponents.delete(id);
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
component.onDidUpdateResource(() => {
|
|
126
|
+
this.storeWebviewResource(id);
|
|
127
|
+
});
|
|
128
|
+
return component;
|
|
129
|
+
}
|
|
130
|
+
createEditorPlainWebviewComponent(options = {}, id) {
|
|
131
|
+
id = id || (this.editorWebviewIdCount++).toString();
|
|
132
|
+
if (this.editorWebviewComponents.has(id)) {
|
|
133
|
+
return this.editorWebviewComponents.get(id);
|
|
134
|
+
}
|
|
135
|
+
const component = this.injector.get(EditorWebviewComponent, [id, () => this.createPlainWebview(options)]);
|
|
136
|
+
this.editorWebviewComponents.set(id, component);
|
|
137
|
+
component.addDispose({
|
|
138
|
+
dispose: () => {
|
|
139
|
+
this.editorWebviewComponents.delete(id);
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
return component;
|
|
143
|
+
}
|
|
144
|
+
getWebviewThemeData(theme) {
|
|
145
|
+
const editorFontFamily = this.editorPreferences['editor.fontFamily'];
|
|
146
|
+
const editorFontWeight = this.editorPreferences['editor.fontFamily'];
|
|
147
|
+
const editorFontSize = this.editorPreferences['editor.fontSize'];
|
|
148
|
+
const exportedColors = (0, color_registry_1.getColorRegistry)().getColors().reduce((colors, entry) => {
|
|
149
|
+
const color = theme.getColor(entry.id);
|
|
150
|
+
if (color) {
|
|
151
|
+
colors['vscode-' + entry.id.replace('.', '-')] = color.toString();
|
|
152
|
+
}
|
|
153
|
+
return colors;
|
|
154
|
+
}, {});
|
|
155
|
+
const styles = Object.assign({ 'vscode-font-family': '-apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "Ubuntu", "Droid Sans", ans-serif', 'vscode-font-weight': 'normal', 'vscode-font-size': '13px', 'vscode-editor-font-family': editorFontFamily, 'vscode-editor-font-weight': editorFontWeight, 'vscode-editor-font-size': editorFontSize }, exportedColors);
|
|
156
|
+
const activeTheme = ApiThemeClassName.fromTheme(theme);
|
|
157
|
+
return { styles, activeTheme };
|
|
158
|
+
}
|
|
159
|
+
getOrCreatePlainWebviewComponent(id, options) {
|
|
160
|
+
if (!this.plainWebviewsComponents.has(id)) {
|
|
161
|
+
const webview = this.createPlainWebview(options);
|
|
162
|
+
const component = this.injector.get(PlainWebviewComponent, [id, webview]);
|
|
163
|
+
this.plainWebviewsComponents.set(id, component);
|
|
164
|
+
component.onDispose(() => {
|
|
165
|
+
this.plainWebviewsComponents.delete(id);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
return this.plainWebviewsComponents.get(id);
|
|
169
|
+
}
|
|
170
|
+
getEditorPlainWebviewComponent(id) {
|
|
171
|
+
const component = this.editorWebviewComponents.get(id);
|
|
172
|
+
if (component && component.webview.loadURL) {
|
|
173
|
+
return component;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
getPlainWebviewComponent(id) {
|
|
177
|
+
return this.plainWebviewsComponents.get(id);
|
|
178
|
+
}
|
|
179
|
+
createWebviewWindow(options, env) {
|
|
180
|
+
if ((0, ide_core_browser_1.isElectronRenderer)()) {
|
|
181
|
+
return this.injector.get(webview_window_1.ElectronPlainWebviewWindow, [options, env]);
|
|
182
|
+
}
|
|
183
|
+
throw new Error('not supported!');
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
(0, tslib_1.__decorate)([
|
|
187
|
+
(0, di_1.Autowired)(di_1.INJECTOR_TOKEN),
|
|
188
|
+
(0, tslib_1.__metadata)("design:type", di_1.Injector)
|
|
189
|
+
], WebviewServiceImpl.prototype, "injector", void 0);
|
|
190
|
+
(0, tslib_1.__decorate)([
|
|
191
|
+
(0, di_1.Autowired)(browser_1.EditorPreferences),
|
|
192
|
+
(0, tslib_1.__metadata)("design:type", Object)
|
|
193
|
+
], WebviewServiceImpl.prototype, "editorPreferences", void 0);
|
|
194
|
+
(0, tslib_1.__decorate)([
|
|
195
|
+
(0, di_1.Autowired)(ide_core_browser_1.ILogger),
|
|
196
|
+
(0, tslib_1.__metadata)("design:type", Object)
|
|
197
|
+
], WebviewServiceImpl.prototype, "logger", void 0);
|
|
198
|
+
(0, tslib_1.__decorate)([
|
|
199
|
+
(0, di_1.Autowired)(ide_core_browser_1.StorageProvider),
|
|
200
|
+
(0, tslib_1.__metadata)("design:type", Function)
|
|
201
|
+
], WebviewServiceImpl.prototype, "getStorage", void 0);
|
|
202
|
+
WebviewServiceImpl = (0, tslib_1.__decorate)([
|
|
203
|
+
(0, di_1.Injectable)(),
|
|
204
|
+
(0, tslib_1.__metadata)("design:paramtypes", [])
|
|
205
|
+
], WebviewServiceImpl);
|
|
206
|
+
exports.WebviewServiceImpl = WebviewServiceImpl;
|
|
207
|
+
var ApiThemeClassName;
|
|
208
|
+
(function (ApiThemeClassName) {
|
|
209
|
+
ApiThemeClassName["light"] = "vscode-light";
|
|
210
|
+
ApiThemeClassName["dark"] = "vscode-dark";
|
|
211
|
+
ApiThemeClassName["highContrast"] = "vscode-high-contrast";
|
|
212
|
+
})(ApiThemeClassName || (ApiThemeClassName = {}));
|
|
213
|
+
(function (ApiThemeClassName) {
|
|
214
|
+
function fromTheme(theme) {
|
|
215
|
+
if (theme.type === 'light') {
|
|
216
|
+
return ApiThemeClassName.light;
|
|
217
|
+
}
|
|
218
|
+
else if (theme.type === 'dark') {
|
|
219
|
+
return ApiThemeClassName.dark;
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
return ApiThemeClassName.highContrast;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
ApiThemeClassName.fromTheme = fromTheme;
|
|
226
|
+
})(ApiThemeClassName || (ApiThemeClassName = {}));
|
|
227
|
+
let EditorWebviewComponent = class EditorWebviewComponent extends ide_core_browser_1.Disposable {
|
|
228
|
+
constructor(id, webviewFactory) {
|
|
229
|
+
super();
|
|
230
|
+
this.id = id;
|
|
231
|
+
this.webviewFactory = webviewFactory;
|
|
232
|
+
this._onDidUpdateResource = new ide_core_browser_1.Emitter();
|
|
233
|
+
this.onDidUpdateResource = this._onDidUpdateResource.event;
|
|
234
|
+
this._onDidChangeGroupIndex = new ide_core_browser_1.Emitter();
|
|
235
|
+
this.onDidChangeGroupIndex = this._onDidChangeGroupIndex.event;
|
|
236
|
+
this._supportsRevive = false;
|
|
237
|
+
this._title = 'Webview';
|
|
238
|
+
this._icon = '';
|
|
239
|
+
const componentId = types_1.EDITOR_WEBVIEW_SCHEME + '_' + this.id;
|
|
240
|
+
this.addDispose(this.editorComponentRegistry.registerEditorComponent({
|
|
241
|
+
scheme: types_1.EDITOR_WEBVIEW_SCHEME,
|
|
242
|
+
uid: componentId,
|
|
243
|
+
component: editor_webview_1.EditorWebviewComponentView,
|
|
244
|
+
renderMode: browser_1.EditorComponentRenderMode.ONE_PER_WORKBENCH,
|
|
245
|
+
}));
|
|
246
|
+
this.addDispose(this.editorComponentRegistry.registerEditorComponentResolver(types_1.EDITOR_WEBVIEW_SCHEME, (resource, results) => {
|
|
247
|
+
if (resource.uri.path.toString() === this.id) {
|
|
248
|
+
results.push({
|
|
249
|
+
type: 'component',
|
|
250
|
+
componentId,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}));
|
|
254
|
+
this.addDispose({
|
|
255
|
+
dispose: () => {
|
|
256
|
+
this.workbenchEditorService.closeAll(this.webviewUri, true);
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
this.addDispose(this.eventBus.on(browser_1.EditorGroupChangeEvent, (e) => {
|
|
260
|
+
var _a;
|
|
261
|
+
if ((_a = e.payload.newResource) === null || _a === void 0 ? void 0 : _a.uri.isEqual(this.webviewUri)) {
|
|
262
|
+
this._onDidChangeGroupIndex.fire(e.payload.group.index);
|
|
263
|
+
}
|
|
264
|
+
}));
|
|
265
|
+
}
|
|
266
|
+
get supportsRevive() {
|
|
267
|
+
return this._supportsRevive;
|
|
268
|
+
}
|
|
269
|
+
set supportsRevive(value) {
|
|
270
|
+
this._supportsRevive = value;
|
|
271
|
+
this.eventBus.fire(new ide_editor_1.ResourceNeedUpdateEvent(this.webviewUri));
|
|
272
|
+
this._onDidUpdateResource.fire(this.resource);
|
|
273
|
+
}
|
|
274
|
+
open(options) {
|
|
275
|
+
return this.workbenchEditorService.open(this.webviewUri, Object.assign(Object.assign({}, options), { preview: false }));
|
|
276
|
+
}
|
|
277
|
+
close() {
|
|
278
|
+
this.workbenchEditorService.closeAll(this.webviewUri);
|
|
279
|
+
}
|
|
280
|
+
get icon() {
|
|
281
|
+
return this._icon;
|
|
282
|
+
}
|
|
283
|
+
set icon(icon) {
|
|
284
|
+
this._icon = icon;
|
|
285
|
+
this.eventBus.fire(new ide_editor_1.ResourceNeedUpdateEvent(this.webviewUri));
|
|
286
|
+
this._onDidUpdateResource.fire(this.resource);
|
|
287
|
+
}
|
|
288
|
+
get title() {
|
|
289
|
+
return this._title;
|
|
290
|
+
}
|
|
291
|
+
set title(title) {
|
|
292
|
+
this._title = title;
|
|
293
|
+
this.eventBus.fire(new ide_editor_1.ResourceNeedUpdateEvent(this.webviewUri));
|
|
294
|
+
this._onDidUpdateResource.fire(this.resource);
|
|
295
|
+
}
|
|
296
|
+
get webview() {
|
|
297
|
+
if (!this._webview) {
|
|
298
|
+
this.createWebview();
|
|
299
|
+
}
|
|
300
|
+
return this._webview;
|
|
301
|
+
}
|
|
302
|
+
get resource() {
|
|
303
|
+
return {
|
|
304
|
+
icon: this.icon,
|
|
305
|
+
name: this.title,
|
|
306
|
+
uri: this.webviewUri,
|
|
307
|
+
metadata: {
|
|
308
|
+
id: this.id,
|
|
309
|
+
options: this.webview.options,
|
|
310
|
+
},
|
|
311
|
+
supportsRevive: this.supportsRevive,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
get webviewUri() {
|
|
315
|
+
return ide_core_browser_1.URI.from({
|
|
316
|
+
scheme: types_1.EDITOR_WEBVIEW_SCHEME,
|
|
317
|
+
path: this.id,
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
get editorGroup() {
|
|
321
|
+
const uri = this.webviewUri;
|
|
322
|
+
return this.workbenchEditorService.editorGroups.find((g) => {
|
|
323
|
+
return g.resources.findIndex((r) => r.uri.isEqual(uri)) !== -1;
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
get group() {
|
|
327
|
+
return this.editorGroup;
|
|
328
|
+
}
|
|
329
|
+
get componentId() {
|
|
330
|
+
return types_1.EDITOR_WEBVIEW_SCHEME + '_' + this.id;
|
|
331
|
+
}
|
|
332
|
+
createWebview() {
|
|
333
|
+
this._webview = this.webviewFactory();
|
|
334
|
+
this.addDispose(this._webview);
|
|
335
|
+
if (typeof this._webview.onDidFocus === 'function') {
|
|
336
|
+
this.addDispose(this._webview.onDidFocus(() => {
|
|
337
|
+
if (this.editorGroup) {
|
|
338
|
+
this.editorGroup.gainFocus();
|
|
339
|
+
}
|
|
340
|
+
}));
|
|
341
|
+
}
|
|
342
|
+
return this._webview;
|
|
343
|
+
}
|
|
344
|
+
clear() {
|
|
345
|
+
const componentId = types_1.EDITOR_WEBVIEW_SCHEME + '_' + this.id;
|
|
346
|
+
this.editorComponentRegistry.clearPerWorkbenchComponentCache(componentId);
|
|
347
|
+
this.webview.remove();
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
(0, tslib_1.__decorate)([
|
|
351
|
+
(0, di_1.Autowired)(),
|
|
352
|
+
(0, tslib_1.__metadata)("design:type", ide_editor_1.WorkbenchEditorService)
|
|
353
|
+
], EditorWebviewComponent.prototype, "workbenchEditorService", void 0);
|
|
354
|
+
(0, tslib_1.__decorate)([
|
|
355
|
+
(0, di_1.Autowired)(),
|
|
356
|
+
(0, tslib_1.__metadata)("design:type", browser_1.EditorComponentRegistry)
|
|
357
|
+
], EditorWebviewComponent.prototype, "editorComponentRegistry", void 0);
|
|
358
|
+
(0, tslib_1.__decorate)([
|
|
359
|
+
(0, di_1.Autowired)(ide_core_browser_1.IEventBus),
|
|
360
|
+
(0, tslib_1.__metadata)("design:type", Object)
|
|
361
|
+
], EditorWebviewComponent.prototype, "eventBus", void 0);
|
|
362
|
+
EditorWebviewComponent = (0, tslib_1.__decorate)([
|
|
363
|
+
(0, di_1.Injectable)({ multiple: true }),
|
|
364
|
+
(0, tslib_1.__metadata)("design:paramtypes", [String, Function])
|
|
365
|
+
], EditorWebviewComponent);
|
|
366
|
+
exports.EditorWebviewComponent = EditorWebviewComponent;
|
|
367
|
+
let PlainWebviewComponent = class PlainWebviewComponent extends ide_core_browser_1.Disposable {
|
|
368
|
+
constructor(id, webview) {
|
|
369
|
+
super();
|
|
370
|
+
this.id = id;
|
|
371
|
+
this.webview = webview;
|
|
372
|
+
this.addDispose(this.webview);
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
PlainWebviewComponent = (0, tslib_1.__decorate)([
|
|
376
|
+
(0, di_1.Injectable)({ multiple: true }),
|
|
377
|
+
(0, tslib_1.__metadata)("design:paramtypes", [String, Object])
|
|
378
|
+
], PlainWebviewComponent);
|
|
379
|
+
exports.PlainWebviewComponent = PlainWebviewComponent;
|
|
380
|
+
//# sourceMappingURL=webview.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webview.service.js","sourceRoot":"","sources":["../../src/browser/webview.service.ts"],"names":[],"mappings":";;;;AAAA,mCAA4R;AAC5R,iEAA0M;AAC1M,mDAA2E;AAC3E,qCAA+E;AAC/E,qDAAsD;AAEtD,kFAAiF;AACjF,qDAAgH;AAChH,8DAAiJ;AACjJ,qDAA8D;AAC9D,yEAAyE;AACzE,qDAA8D;AAG9D,IAAa,kBAAkB,GAA/B,MAAa,kBAAkB;IA4B7B;QA1BQ,mBAAc,GAAG,CAAC,CAAC;QAEnB,yBAAoB,GAAG,CAAC,CAAC;QAEjB,4BAAuB,GAAG,IAAI,GAAG,EAA4D,CAAC;QAE9F,4BAAuB,GAAG,IAAI,GAAG,EAAwC,CAAC;QAEzE,aAAQ,GAAG,IAAI,GAAG,EAAoB,CAAC;QAQhD,cAAS,GAAsB,EAAE,CAAC;QAWxC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,sBAAG,CAAC,gBAAgB,CAAC,CAAC,UAAU,CAAC,iCAAc,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7F,CAAC;IAED,KAAK,CAAC,yBAAyB,CAAC,EAAU;QACxC,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YAC7B,IAAI,aAGQ,CAAC;YACb,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,SAAS,EAAE;gBACpC,IAAI;oBACF,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,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AA;AAtJC;IADC,IAAA,cAAS,GAAE;2CACY,mCAAsB;sEAAC;AAG/C;IADC,IAAA,cAAS,GAAE;2CACa,iCAAuB;uEAAC;AAGjD;IADC,IAAA,cAAS,EAAC,4BAAS,CAAC;;wDACD;AATT,sBAAsB;IADlC,IAAA,eAAU,EAAC,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;;GAChB,sBAAsB,CAyJlC;AAzJY,wDAAsB;AA4JnC,IAAa,qBAAqB,GAAlC,MAAa,qBAAsB,SAAQ,6BAAU;IAEnD,YAA4B,EAAU,EAAkB,OAAO;QAC7D,KAAK,EAAE,CAAC;QADkB,OAAE,GAAF,EAAE,CAAQ;QAAkB,YAAO,GAAP,OAAO,CAAA;QAE7D,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;CAEF,CAAA;AAPY,qBAAqB;IADjC,IAAA,eAAU,EAAC,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;;GAChB,qBAAqB,CAOjC;AAPY,sDAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,aAAa,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;AACa,QAAA,aAAa,GAAG,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ElectronMainContribution, ElectronMainModule } from '@opensumi/ide-core-electron-main';
|
|
2
|
+
export declare class WebviewMainElectronContribution implements ElectronMainContribution {
|
|
3
|
+
private webviewContent;
|
|
4
|
+
onStart(): void;
|
|
5
|
+
}
|
|
6
|
+
export declare class WebviewElectronMainModule extends ElectronMainModule {
|
|
7
|
+
providers: (typeof WebviewMainElectronContribution)[];
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/electron-main/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAchG,qBACa,+BAAgC,YAAW,wBAAwB;IAE9E,OAAO,CAAC,cAAc,CAA0O;IAEhQ,OAAO;CAKR;AAED,qBACa,yBAA0B,SAAQ,kBAAkB;IAE/D,SAAS,6CAEP;CACH"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebviewElectronMainModule = exports.WebviewMainElectronContribution = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const ide_core_electron_main_1 = require("@opensumi/ide-core-electron-main");
|
|
6
|
+
const ide_core_common_1 = require("@opensumi/ide-core-common");
|
|
7
|
+
const electron_1 = require("electron");
|
|
8
|
+
const protocol_1 = require("@opensumi/ide-core-electron-main/lib/bootstrap/services/protocol");
|
|
9
|
+
const common_1 = require("../common");
|
|
10
|
+
const di_1 = require("@opensumi/di");
|
|
11
|
+
protocol_1.ProtocolElectronMainContribution.schemePrivileges.push({
|
|
12
|
+
scheme: common_1.WebviewScheme,
|
|
13
|
+
privileges: { standard: true, secure: true, supportFetchAPI: true, corsEnabled: true, allowServiceWorkers: true },
|
|
14
|
+
});
|
|
15
|
+
let WebviewMainElectronContribution = class WebviewMainElectronContribution {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.webviewContent = '<!DOCTYPE html>\r\n<html lang=\"en\" style=\"width: 100%; height: 100%\">\r\n<head>\r\n\t<title>Virtual Document</title>\r\n</head>\r\n<body style=\"margin: 0; overflow: hidden; width: 100%; height: 100%\">\r\n</body>\r\n</html>';
|
|
18
|
+
}
|
|
19
|
+
onStart() {
|
|
20
|
+
electron_1.protocol.registerStringProtocol(common_1.WebviewScheme, (_request, callback) => {
|
|
21
|
+
callback(this.webviewContent);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
WebviewMainElectronContribution = (0, tslib_1.__decorate)([
|
|
26
|
+
(0, ide_core_common_1.Domain)(ide_core_electron_main_1.ElectronMainContribution)
|
|
27
|
+
], WebviewMainElectronContribution);
|
|
28
|
+
exports.WebviewMainElectronContribution = WebviewMainElectronContribution;
|
|
29
|
+
let WebviewElectronMainModule = class WebviewElectronMainModule extends ide_core_electron_main_1.ElectronMainModule {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.providers = [
|
|
33
|
+
WebviewMainElectronContribution,
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
WebviewElectronMainModule = (0, tslib_1.__decorate)([
|
|
38
|
+
(0, di_1.Injectable)()
|
|
39
|
+
], WebviewElectronMainModule);
|
|
40
|
+
exports.WebviewElectronMainModule = WebviewElectronMainModule;
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/electron-main/index.ts"],"names":[],"mappings":";;;;AAAA,6EAAgG;AAChG,+DAAmD;AACnD,uCAAoC;AACpC,+FAAoH;AACpH,sCAA0C;AAC1C,qCAA0C;AAE1C,2CAAgC,CAAC,gBAAgB,CAAC,IAAI,CACpD;IACE,MAAM,EAAE,sBAAa;IACrB,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE;CAClH,CACF,CAAC;AAGF,IAAa,+BAA+B,GAA5C,MAAa,+BAA+B;IAA5C;QAEU,mBAAc,GAAG,sOAAsO,CAAC;IAOlQ,CAAC;IALC,OAAO;QACL,mBAAQ,CAAC,sBAAsB,CAAC,sBAAa,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE;YACpE,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AATY,+BAA+B;IAD3C,IAAA,wBAAM,EAAC,iDAAwB,CAAC;GACpB,+BAA+B,CAS3C;AATY,0EAA+B;AAY5C,IAAa,yBAAyB,GAAtC,MAAa,yBAA0B,SAAQ,2CAAkB;IAAjE;;QAEE,cAAS,GAAG;YACV,+BAA+B;SAChC,CAAC;IACJ,CAAC;CAAA,CAAA;AALY,yBAAyB;IADrC,IAAA,eAAU,GAAE;GACA,yBAAyB,CAKrC;AALY,8DAAyB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IWebviewChannel } from '../webview-host/common';
|
|
2
|
+
export declare class ElectronWebviewChannel implements IWebviewChannel {
|
|
3
|
+
private handlers;
|
|
4
|
+
focusIframeOnCreate?: boolean | undefined;
|
|
5
|
+
ready?: Promise<void> | undefined;
|
|
6
|
+
fakeLoad: boolean;
|
|
7
|
+
private isInDevelopmentMode;
|
|
8
|
+
constructor();
|
|
9
|
+
postMessage(channel: any, data?: any): void;
|
|
10
|
+
onMessage(channel: any, handler: any): void;
|
|
11
|
+
onIframeLoaded(newFrame: any): void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=host-channel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-channel.d.ts","sourceRoot":"","sources":["../../src/electron-webview/host-channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAIzD,qBAAa,sBAAuB,YAAW,eAAe;IAE5D,OAAO,CAAC,QAAQ,CAAa;IAC7B,mBAAmB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1C,KAAK,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;IAClC,QAAQ,EAAE,OAAO,CAAS;IAE1B,OAAO,CAAC,mBAAmB,CAAS;;IA6BpC,WAAW,CAAC,OAAO,KAAA,EAAE,IAAI,CAAC,KAAA;IAI1B,SAAS,CAAC,OAAO,KAAA,EAAE,OAAO,KAAA;IAI1B,cAAc,CAAC,QAAQ,KAAA;CAWxB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ElectronWebviewChannel = void 0;
|
|
4
|
+
const webview_manager_1 = require("../webview-host/webview-manager");
|
|
5
|
+
const electron_1 = require("electron");
|
|
6
|
+
class ElectronWebviewChannel {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.handlers = new Map();
|
|
9
|
+
this.fakeLoad = false;
|
|
10
|
+
// tslint:disable-next-line: no-unused-variable
|
|
11
|
+
this.isInDevelopmentMode = false;
|
|
12
|
+
window.addEventListener('message', (e) => {
|
|
13
|
+
if (e.data && (e.data.command === 'onmessage' || e.data.command === 'do-update-state')) {
|
|
14
|
+
// Came from inner iframe
|
|
15
|
+
this.postMessage(e.data.command, e.data.data);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const channel = e.data.channel;
|
|
19
|
+
const handler = this.handlers.get(channel);
|
|
20
|
+
if (handler) {
|
|
21
|
+
handler(e, e.data.data);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
// tslint:disable-next-line: no-console
|
|
25
|
+
console.warn('no handler for ', e);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
this.ready = new Promise(async (resolve) => {
|
|
29
|
+
resolve();
|
|
30
|
+
});
|
|
31
|
+
this.onMessage('devtools-opened', () => {
|
|
32
|
+
this.isInDevelopmentMode = true;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
postMessage(channel, data) {
|
|
36
|
+
electron_1.ipcRenderer.sendToHost(channel, data);
|
|
37
|
+
}
|
|
38
|
+
onMessage(channel, handler) {
|
|
39
|
+
electron_1.ipcRenderer.on(channel, handler);
|
|
40
|
+
}
|
|
41
|
+
onIframeLoaded(newFrame) {
|
|
42
|
+
// newFrame.contentWindow.onbeforeunload = () => {
|
|
43
|
+
// if (this.isInDevelopmentMode) { // Allow reloads while developing a webview
|
|
44
|
+
// this.postMessage('do-reload');
|
|
45
|
+
// return false;
|
|
46
|
+
// }
|
|
47
|
+
// // Block navigation when not in development mode
|
|
48
|
+
// console.log('prevented webview navigation');
|
|
49
|
+
// return false;
|
|
50
|
+
// };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.ElectronWebviewChannel = ElectronWebviewChannel;
|
|
54
|
+
/* tslint:disable */
|
|
55
|
+
new webview_manager_1.WebviewPanelManager(new ElectronWebviewChannel());
|
|
56
|
+
/* tslint:enable */
|
|
57
|
+
//# sourceMappingURL=host-channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-channel.js","sourceRoot":"","sources":["../../src/electron-webview/host-channel.ts"],"names":[],"mappings":";;;AACA,qEAAsE;AACtE,uCAAuC;AAEvC,MAAa,sBAAsB;IASjC;QAPQ,aAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;QAG7B,aAAQ,GAAY,KAAK,CAAC;QAC1B,+CAA+C;QACvC,wBAAmB,GAAG,KAAK,CAAC;QAGlC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;YACvC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,KAAK,WAAW,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,KAAK,iBAAiB,CAAC,EAAE;gBACtF,yBAAyB;gBACzB,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC9C,OAAO;aACR;YAED,MAAM,OAAO,GAAG,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Params = new URLSearchParams(decodeURIComponent(window.location.search));
|
|
7
|
+
window.id = Number(urlParams.get('windowId'));
|
|
8
|
+
|
|
9
|
+
let parentWindowWebContentsId;
|
|
10
|
+
let additionalEnv;
|
|
11
|
+
|
|
12
|
+
argv.forEach((arg) => {
|
|
13
|
+
if ( arg.indexOf('--parentWindowWebContentsId=') === 0 ) {
|
|
14
|
+
parentWindowWebContentsId = parseInt(arg.substr('--parentWindowWebContentsId='.length), 10);
|
|
15
|
+
}
|
|
16
|
+
if ( arg.indexOf('--additionalEnv=') === 0 ) {
|
|
17
|
+
additionalEnv = JSON.parse(arg.substr('--additionalEnv='.length))
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
let postMessage = undefined;
|
|
22
|
+
|
|
23
|
+
if (parentWindowWebContentsId) {
|
|
24
|
+
postMessage = (message) => {
|
|
25
|
+
ipcRenderer.sendTo(parentWindowWebContentsId, 'cross-window-webview-message', {
|
|
26
|
+
from: window.id,
|
|
27
|
+
message
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
postMessage = (message) => {
|
|
32
|
+
ipcRenderer.sendToHost('webview-message', message);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (additionalEnv) {
|
|
37
|
+
window.env = Object.assign({}, additionalEnv);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const parent = window.parent;
|
|
41
|
+
|
|
42
|
+
window.parent = new Proxy(window.parent, {
|
|
43
|
+
get: (target,p) => {
|
|
44
|
+
if(p === 'postMessage') {
|
|
45
|
+
return postMessage;
|
|
46
|
+
} else {
|
|
47
|
+
return Reflect.get(target, p);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
ipcRenderer.on('webview-message', (e, data) => {
|
|
53
|
+
const messageEvent = new MessageEvent('message', { data:data, source: parent});
|
|
54
|
+
window.dispatchEvent(messageEvent);
|
|
55
|
+
})
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
package/lib/index.js
ADDED
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yDAA0B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const defaultCss = "body {\n background-color: var(--vscode-editor-background);\n color: var(--vscode-editor-foreground);\n font-family: var(--vscode-font-family);\n font-weight: var(--vscode-font-weight);\n font-size: var(--vscode-font-size);\n margin: 0;\n padding: 0 20px;\n}\n\nimg {\n max-width: 100%;\n max-height: 100%;\n}\n\na {\n color: var(--vscode-textLink-foreground);\n}\n\na:hover {\n color: var(--vscode-textLink-activeForeground);\n}\n\na:focus,\ninput:focus,\nselect:focus,\ntextarea:focus {\n outline: 1px solid -webkit-focus-ring-color;\n outline-offset: -1px;\n}\n\ncode {\n color: var(--vscode-textPreformat-foreground);\n}\n\nblockquote {\n background: var(--vscode-textBlockQuote-background);\n border-color: var(--vscode-textBlockQuote-border);\n}\n\n::-webkit-scrollbar {\n width: 10px;\n height: 10px;\n}\n\n::-webkit-scrollbar-thumb {\n background-color: var(--vscode-scrollbarSlider-background);\n}\n::-webkit-scrollbar-thumb:hover {\n background-color: var(--vscode-scrollbarSlider-hoverBackground);\n}\n::-webkit-scrollbar-thumb:active {\n background-color: var(--vscode-scrollbarSlider-activeBackground);\n}";
|
|
2
|
+
export interface IWebviewChannel {
|
|
3
|
+
postMessage: (channel: string, data?: any) => void;
|
|
4
|
+
onMessage: (channel: string, handler: any) => void;
|
|
5
|
+
focusIframeOnCreate?: boolean;
|
|
6
|
+
ready?: Promise<void>;
|
|
7
|
+
onIframeLoaded?: (iframe: HTMLIFrameElement) => void;
|
|
8
|
+
fakeLoad: boolean;
|
|
9
|
+
onKeydown?: (event: KeyboardEvent) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function getVsCodeApiScript(state: any): string;
|
|
12
|
+
//# sourceMappingURL=common.d.ts.map
|