提交 ee1a39e1 编写于 作者: R Rob Lourens

Fix sizing cell incorrectly for webview outputs

- webview outputs are not "hasDynamicHeight"
- The "else if" condition got flipped around in the last change
上级 8bfdb0f8
...@@ -325,7 +325,7 @@ export class CodeCell extends Disposable { ...@@ -325,7 +325,7 @@ export class CodeCell extends Disposable {
if (renderedOutput.renderResult.type !== RenderOutputType.None) { if (renderedOutput.renderResult.type !== RenderOutputType.None) {
// Show inset in webview, or render output that isn't rendered // Show inset in webview, or render output that isn't rendered
// TODO@roblou skipHeightInit flag is a hack - the webview only sends the real height once. Don't wipe it out here. // TODO@roblou skipHeightInit flag is a hack - the webview only sends the real height once. Don't wipe it out here.
this.renderOutput(currOutput, index, undefined, true); this.renderOutput(currOutput, index, undefined);
} else { } else {
// Anything else, just update the height // Anything else, just update the height
this.viewCell.updateOutputHeight(index, renderedOutput.element.clientHeight); this.viewCell.updateOutputHeight(index, renderedOutput.element.clientHeight);
...@@ -430,7 +430,7 @@ export class CodeCell extends Disposable { ...@@ -430,7 +430,7 @@ export class CodeCell extends Disposable {
); );
} }
private renderOutput(currOutput: IProcessedOutput, index: number, beforeElement?: HTMLElement, skipHeightInit = false) { private renderOutput(currOutput: IProcessedOutput, index: number, beforeElement?: HTMLElement) {
if (!this.outputResizeListeners.has(currOutput)) { if (!this.outputResizeListeners.has(currOutput)) {
this.outputResizeListeners.set(currOutput, new DisposableStore()); this.outputResizeListeners.set(currOutput, new DisposableStore());
} }
...@@ -510,7 +510,6 @@ export class CodeCell extends Disposable { ...@@ -510,7 +510,6 @@ export class CodeCell extends Disposable {
outputItemDiv.style.position = 'absolute'; outputItemDiv.style.position = 'absolute';
} }
if (!skipHeightInit) {
if (outputHasDynamicHeight(result)) { if (outputHasDynamicHeight(result)) {
this.viewCell.selfSizeMonitoring = true; this.viewCell.selfSizeMonitoring = true;
...@@ -539,7 +538,7 @@ export class CodeCell extends Disposable { ...@@ -539,7 +538,7 @@ export class CodeCell extends Disposable {
elementSizeObserver.startObserving(); elementSizeObserver.startObserving();
this.outputResizeListeners.get(currOutput)!.add(elementSizeObserver); this.outputResizeListeners.get(currOutput)!.add(elementSizeObserver);
this.viewCell.updateOutputHeight(index, clientHeight); this.viewCell.updateOutputHeight(index, clientHeight);
} else if (result.type !== RenderOutputType.None) { // no-op if it's a webview } else if (result.type === RenderOutputType.None) { // no-op if it's a webview
const clientHeight = Math.ceil(outputItemDiv.clientHeight); const clientHeight = Math.ceil(outputItemDiv.clientHeight);
this.viewCell.updateOutputHeight(index, clientHeight); this.viewCell.updateOutputHeight(index, clientHeight);
...@@ -547,7 +546,6 @@ export class CodeCell extends Disposable { ...@@ -547,7 +546,6 @@ export class CodeCell extends Disposable {
outputItemDiv.style.top = `${top}px`; outputItemDiv.style.top = `${top}px`;
} }
} }
}
generateRendererInfo(renderId: string | undefined): string { generateRendererInfo(renderId: string | undefined): string {
if (renderId === undefined || renderId === BUILTIN_RENDERER_ID) { if (renderId === undefined || renderId === BUILTIN_RENDERER_ID) {
......
...@@ -313,7 +313,7 @@ export interface IRenderOutputViaExtension { ...@@ -313,7 +313,7 @@ export interface IRenderOutputViaExtension {
export type IInsetRenderOutput = IRenderPlainHtmlOutput | IRenderOutputViaExtension; export type IInsetRenderOutput = IRenderPlainHtmlOutput | IRenderOutputViaExtension;
export type IRenderOutput = IRenderNoOutput | IInsetRenderOutput; export type IRenderOutput = IRenderNoOutput | IInsetRenderOutput;
export const outputHasDynamicHeight = (o: IRenderOutput) => o.type === RenderOutputType.Extension || o.hasDynamicHeight; export const outputHasDynamicHeight = (o: IRenderOutput) => o.type !== RenderOutputType.Extension && o.hasDynamicHeight;
export type NotebookCellTextModelSplice = [ export type NotebookCellTextModelSplice = [
number /* start */, number /* start */,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册