@@ -16,13 +16,11 @@ import { NotebookOutputWebview } from './notebookOutputWebview.js';
16
16
import { INotebookOutputWebview , IPositronNotebookOutputWebviewService } from './notebookOutputWebviewService.js' ;
17
17
import { IWebviewService , WebviewInitInfo } from '../../webview/browser/webview.js' ;
18
18
import { asWebviewUri } from '../../webview/common/webview.js' ;
19
- import { IExtensionService } from '../../../services/extensions/common/extensions.js' ;
20
19
import { ILanguageRuntimeMessageWebOutput } from '../../../services/languageRuntime/common/languageRuntimeService.js' ;
21
20
import { ILanguageRuntimeSession } from '../../../services/runtimeSession/common/runtimeSessionService.js' ;
22
21
import { dirname } from '../../../../base/common/resources.js' ;
23
22
import { INotebookRendererMessagingService } from '../../notebook/common/notebookRendererMessagingService.js' ;
24
23
import { ILogService } from '../../../../platform/log/common/log.js' ;
25
- import { handleWebviewLinkClicksInjection } from './downloadUtils.js' ;
26
24
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js' ;
27
25
import { webviewMessageCodeString } from '../../positronWebviewPreloads/browser/notebookOutputUtils.js' ;
28
26
@@ -45,7 +43,6 @@ export class PositronNotebookOutputWebviewService implements IPositronNotebookOu
45
43
@IWebviewService private readonly _webviewService : IWebviewService ,
46
44
@INotebookService private readonly _notebookService : INotebookService ,
47
45
@IWorkspaceTrustManagementService private readonly _workspaceTrustManagementService : IWorkspaceTrustManagementService ,
48
- @IExtensionService private readonly _extensionService : IExtensionService ,
49
46
@INotebookRendererMessagingService private readonly _notebookRendererMessagingService : INotebookRendererMessagingService ,
50
47
@ILogService private _logService : ILogService ,
51
48
@IInstantiationService private readonly _instantiationService : IInstantiationService
@@ -147,7 +144,6 @@ export class PositronNotebookOutputWebviewService implements IPositronNotebookOu
147
144
for ( const mimeType of Object . keys ( output . data ) ) {
148
145
// Don't use a renderer for non-widget MIME types
149
146
if ( mimeType === 'text/plain' ||
150
- mimeType === 'text/html' ||
151
147
mimeType === 'image/png' ) {
152
148
continue ;
153
149
}
@@ -163,18 +159,6 @@ export class PositronNotebookOutputWebviewService implements IPositronNotebookOu
163
159
}
164
160
}
165
161
166
- // If no dedicated renderer is found, check to see if there is a raw
167
- // HTML representation of the output.
168
- for ( const mimeType of Object . keys ( output . data ) ) {
169
- if ( mimeType === 'text/html' ) {
170
- return this . createRawHtmlOutput ( {
171
- id,
172
- runtimeOrSessionId : runtime ,
173
- html : output . data [ mimeType ] ,
174
- } ) ;
175
- }
176
- }
177
-
178
162
// No renderer found
179
163
return Promise . resolve ( undefined ) ;
180
164
}
@@ -394,70 +378,6 @@ export class PositronNotebookOutputWebviewService implements IPositronNotebookOu
394
378
return notebookOutputWebview ;
395
379
}
396
380
397
- async createRawHtmlOutput ( { id, html, runtimeOrSessionId } : {
398
- id : string ;
399
- html : string ;
400
- runtimeOrSessionId : ILanguageRuntimeSession | string ;
401
- } ) : Promise < INotebookOutputWebview > {
402
-
403
- // Load the Jupyter extension. Many notebook HTML outputs have a dependency on jQuery,
404
- // which is provided by the Jupyter extension.
405
- const jupyterExtension = await this . _extensionService . getExtension ( 'ms-toolsai.jupyter' ) ;
406
- if ( ! jupyterExtension ) {
407
- return Promise . reject ( `Jupyter extension 'ms-toolsai.jupyter' not found` ) ;
408
- }
409
-
410
- // Create the metadata for the webview
411
- const webviewInitInfo : WebviewInitInfo = {
412
- // Use the active window's origin. All webviews with the same origin will reuse the same
413
- // service worker.
414
- origin : DOM . getActiveWindow ( ) . origin ,
415
- contentOptions : {
416
- allowScripts : true ,
417
- localResourceRoots : [ jupyterExtension . extensionLocation ]
418
- } ,
419
- options : { } ,
420
- title : '' ,
421
- // Sometimes we don't have an active runtime (e.g. rendering html for a notebook pre
422
- // runtime start) so we can't get the extension id from the runtime.
423
- extension : typeof runtimeOrSessionId === 'string' ? undefined : { id : runtimeOrSessionId . runtimeMetadata . extensionId }
424
- } ;
425
-
426
- const webview = this . _webviewService . createWebviewOverlay ( webviewInitInfo ) ;
427
-
428
- // Form the path to the jQuery library and inject it into the HTML
429
- const jQueryPath = asWebviewUri (
430
- jupyterExtension . extensionLocation . with ( {
431
- path : jupyterExtension . extensionLocation . path +
432
- '/out/node_modules/jquery/dist/jquery.min.js'
433
- } ) ) ;
434
-
435
- webview . setHtml ( `
436
- <script src='${ jQueryPath } '></script>
437
- ${ PositronNotebookOutputWebviewService . CssAddons }
438
- ${ html }
439
- <script>
440
- const vscode = acquireVsCodeApi();
441
- window.onload = function() {
442
- vscode.postMessage({
443
- __vscode_notebook_message: true,
444
- type: 'positronRenderComplete',
445
- });
446
-
447
- ${ handleWebviewLinkClicksInjection } ;
448
- };
449
- </script>` ) ;
450
-
451
- return this . _instantiationService . createInstance (
452
- NotebookOutputWebview ,
453
- {
454
- id,
455
- sessionId : typeof runtimeOrSessionId === 'string' ? runtimeOrSessionId : runtimeOrSessionId . sessionId ,
456
- webview
457
- }
458
- ) ;
459
- }
460
-
461
381
/**
462
382
* A set of CSS addons to inject into the HTML of the webview. Used to do things like
463
383
* hide elements that are not functional in the context of positron such as links to
0 commit comments