diff --git a/packages/plugin-ext/src/main/browser/notebooks/renderers/output-webview-internal.ts b/packages/plugin-ext/src/main/browser/notebooks/renderers/output-webview-internal.ts index 7c77c3de51284..4d1f76c91dba4 100644 --- a/packages/plugin-ext/src/main/browser/notebooks/renderers/output-webview-internal.ts +++ b/packages/plugin-ext/src/main/browser/notebooks/renderers/output-webview-internal.ts @@ -314,10 +314,17 @@ export async function outputWebviewPreload(ctx: PreloadContext): Promise { // we need to check for all images are loaded. Otherwise we can't determine the correct height of the output const images = Array.from(document.images); if (images.length > 0) { - Promise.all(images.filter(img => !img.complete).map(img => new Promise(resolve => { img.onload = img.onerror = resolve; }))).then(() => - theia.postMessage({ type: 'didRenderOutput', contentHeight: document.body.clientHeight })); + Promise.all(images.filter(img => !img.complete).map(img => new Promise(resolve => { img.onload = img.onerror = resolve; }))).then(() => { + theia.postMessage({ type: 'didRenderOutput', contentHeight: document.body.clientHeight }); + new ResizeObserver(() => + theia.postMessage({ type: 'didRenderOutput', contentHeight: document.body.clientHeight })) + .observe(document.body); + }); } else { theia.postMessage({ type: 'didRenderOutput', contentHeight: document.body.clientHeight }); + new ResizeObserver(() => + theia.postMessage({ type: 'didRenderOutput', contentHeight: document.body.clientHeight })) + .observe(document.body); } }