Re #172417. Clear output rendered by previously picked renderer. (#172566)

This commit is contained in:
Peng Lyu
2023-01-26 10:40:18 -08:00
committed by GitHub
parent 40b8a2dab9
commit 1a58734121

View File

@@ -2630,11 +2630,14 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
const existingOutput = this._webview.insetMapping.get(output.source);
if (!existingOutput
|| (!existingOutput.renderer && output.type === RenderOutputType.Extension)
|| (existingOutput.renderer
&& output.type === RenderOutputType.Extension
&& existingOutput.renderer.id !== output.renderer.id)
) {
this._webview.createOutput({ cellId: cell.id, cellHandle: cell.handle, cellUri: cell.uri }, output, cellTop, offset);
} else if (existingOutput.renderer
&& output.type === RenderOutputType.Extension
&& existingOutput.renderer.id !== output.renderer.id) {
// switch mimetype
this._webview.removeInsets([output.source]);
this._webview.createOutput({ cellId: cell.id, cellHandle: cell.handle, cellUri: cell.uri }, output, cellTop, offset);
} else {
const outputIndex = cell.outputsViewModels.indexOf(output.source);
const outputOffset = cell.getOutputOffset(outputIndex);