fix zero height output height.

This commit is contained in:
rebornix 2021-05-21 15:09:10 -07:00
parent 7bc2019b8d
commit cd8bf7ba53
No known key found for this signature in database
GPG key ID: 181FC90D15393C20
3 changed files with 14 additions and 0 deletions

View file

@ -118,6 +118,7 @@ export interface ICellOutputViewModel {
resolveMimeTypes(textModel: NotebookTextModel, kernelProvides: readonly string[] | undefined): [readonly IOrderedMimeType[], number];
pickedMimeType: number;
supportAppend(): boolean;
hasMultiMimeType(): boolean;
toRawJSON(): any;
}

View file

@ -33,6 +33,15 @@ export class CellOutputViewModel extends Disposable implements ICellOutputViewMo
super();
}
hasMultiMimeType() {
if (this._outputRawData.outputs.length < 2) {
return false;
}
const firstMimeType = this._outputRawData.outputs[0].mime;
return this._outputRawData.outputs.some(output => output.mime !== firstMimeType);
}
supportAppend() {
// if there is any mime type that's not mergeable then the whole output is not mergeable.
return this._outputRawData.outputs.every(op => mimeTypeIsMergeable(op.mime));

View file

@ -343,6 +343,10 @@ export class CodeCellViewModel extends BaseCellViewModel implements ICellViewMod
}
this._ensureOutputsTop();
if (height < 28 && this._outputViewModels[index].hasMultiMimeType()) {
height = 28;
}
this._outputCollection[index] = height;
if (this._outputsTop!.changeValue(index, height)) {
this.layoutChange({ outputHeight: true }, source);