Merge pull request #130854 from jeanp413/fix-130725

Fixes notebook UI displayed over terminal
This commit is contained in:
Peng Lyu 2021-08-18 14:48:00 -07:00 committed by GitHub
commit eab604688a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1582,23 +1582,26 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
return;
}
const topInserToolbarHeight = this._notebookOptions.computeTopInserToolbarHeight(this.viewModel?.viewType);
this._dimension = new DOM.Dimension(dimension.width, dimension.height);
DOM.size(this._body, dimension.width, dimension.height - (this._notebookTopToolbar?.useGlobalToolbar ? /** Toolbar height */ 26 : 0));
if (this._list.getRenderHeight() < dimension.height - topInserToolbarHeight) {
const newBodyHeight = Math.max(dimension.height - (this._notebookTopToolbar?.useGlobalToolbar ? /** Toolbar height */ 26 : 0), 0);
DOM.size(this._body, dimension.width, newBodyHeight);
const topInserToolbarHeight = this._notebookOptions.computeTopInserToolbarHeight(this.viewModel?.viewType);
const newCellListHeight = Math.max(dimension.height - topInserToolbarHeight, 0);
if (this._list.getRenderHeight() < newCellListHeight) {
// the new dimension is larger than the list viewport, update its additional height first, otherwise the list view will move down a bit (as the `scrollBottom` will move down)
this._list.updateOptions({ additionalScrollHeight: this._allowScrollBeyondLastLine() ? Math.max(0, (dimension.height - topInserToolbarHeight - 50)) : topInserToolbarHeight });
this._list.layout(dimension.height - topInserToolbarHeight, dimension.width);
this._list.updateOptions({ additionalScrollHeight: this._allowScrollBeyondLastLine() ? Math.max(0, (newCellListHeight - 50)) : topInserToolbarHeight });
this._list.layout(newCellListHeight, dimension.width);
} else {
// the new dimension is smaller than the list viewport, if we update the additional height, the `scrollBottom` will move up, which moves the whole list view upwards a bit. So we run a layout first.
this._list.layout(dimension.height - topInserToolbarHeight, dimension.width);
this._list.updateOptions({ additionalScrollHeight: this._allowScrollBeyondLastLine() ? Math.max(0, (dimension.height - topInserToolbarHeight - 50)) : topInserToolbarHeight });
this._list.layout(newCellListHeight, dimension.width);
this._list.updateOptions({ additionalScrollHeight: this._allowScrollBeyondLastLine() ? Math.max(0, (newCellListHeight - 50)) : topInserToolbarHeight });
}
this._overlayContainer.style.visibility = 'visible';
this._overlayContainer.style.display = 'block';
this._overlayContainer.style.position = 'absolute';
this._overlayContainer.style.overflow = 'hidden';
const containerRect = this._overlayContainer.parentElement?.getBoundingClientRect();
this._overlayContainer.style.top = `${this._shadowElementViewInfo!.top - (containerRect?.top || 0)}px`;