fix output max height update for diff editor.

This commit is contained in:
rebornix
2021-04-19 17:55:24 -07:00
parent 8fa6582b83
commit 65273f89bc
4 changed files with 26 additions and 5 deletions
@@ -483,7 +483,28 @@ export class NotebookTextDiffEditor extends EditorPane implements INotebookTextD
}
}
scheduleOutputHeightAck() { }
scheduleOutputHeightAck(cellInfo: IDiffCellInfo, outputId: string, height: number) {
const diffElement = cellInfo.diffElement;
// const activeWebview = diffSide === DiffSide.Modified ? this._modifiedWebview : this._originalWebview;
let diffSide = DiffSide.Original;
if (diffElement instanceof SideBySideDiffElementViewModel) {
const info = CellUri.parse(cellInfo.cellUri);
if (!info) {
return;
}
diffSide = info.notebook.toString() === this._model?.original.resource.toString() ? DiffSide.Original : DiffSide.Modified;
} else {
diffSide = diffElement.type === 'insert' ? DiffSide.Modified : DiffSide.Original;
}
const webview = diffSide === DiffSide.Modified ? this._modifiedWebview : this._originalWebview;
DOM.scheduleAtNextAnimationFrame(() => {
webview?.ackHeight(cellInfo.cellId, outputId, height);
}, 10);
}
private _computeModifiedLCS(change: IDiffChange, originalModel: NotebookTextModel, modifiedModel: NotebookTextModel) {
const result: DiffElementViewModelBase[] = [];
@@ -173,7 +173,7 @@ export interface ICommonNotebookEditor {
focusNotebookCell(cell: IGenericCellViewModel, focus: 'editor' | 'container' | 'output', options?: IFocusNotebookCellOptions): void;
focusNextNotebookCell(cell: IGenericCellViewModel, focus: 'editor' | 'container' | 'output'): void;
updateOutputHeight(cellInfo: ICommonCellInfo, output: IDisplayOutputViewModel, height: number, isInit: boolean, source?: string): void;
scheduleOutputHeightAck(cellId: string, outputId: string, height: number): void;
scheduleOutputHeightAck(cellInfo: ICommonCellInfo, outputId: string, height: number): void;
updateMarkdownCellHeight(cellId: string, height: number, isInit: boolean): void;
setMarkdownCellEditState(cellId: string, editState: CellEditState): void;
markdownCellDragStart(cellId: string, position: { clientY: number }): void;
@@ -2355,12 +2355,12 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
}
}
scheduleOutputHeightAck(cellId: string, outputId: string, height: number) {
scheduleOutputHeightAck(cellInfo: ICommonCellInfo, outputId: string, height: number) {
DOM.scheduleAtNextAnimationFrame(() => {
this.updateScrollHeight();
this._debug('ack height', height);
this._webview?.ackHeight(cellId, outputId, height);
this._webview?.ackHeight(cellInfo.cellId, outputId, height);
}, 10);
}
@@ -874,7 +874,7 @@ var requirejs = (function() {
if (resolvedResult) {
const { cellInfo, output } = resolvedResult;
this.notebookEditor.updateOutputHeight(cellInfo, output, height, !!update.init, 'webview#dimension');
this.notebookEditor.scheduleOutputHeightAck(cellInfo.cellId, update.id, height);
this.notebookEditor.scheduleOutputHeightAck(cellInfo, update.id, height);
}
} else {
this.notebookEditor.updateMarkdownCellHeight(update.id, height, !!update.init);