Merge pull request #193224 from microsoft/aamunger/scrollNotebooks

account for toolbar size when measuring initial body height
This commit is contained in:
Aaron Munger 2023-09-15 11:06:34 -07:00 committed by GitHub
commit 9892b66efe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1512,7 +1512,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
}));
if (this._dimension) {
this._list.layout(this._dimension.height, this._dimension.width);
this._list.layout(this.getBodyHeight(this._dimension.height), this._dimension.width);
} else {
this._list.layout();
}
@ -1779,6 +1779,10 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
return this._scrollBeyondLastLine && !this.isEmbedded;
}
private getBodyHeight(dimensionHeight: number) {
return Math.max(dimensionHeight - (this._notebookTopToolbar?.useGlobalToolbar ? /** Toolbar height */ 26 : 0), 0);
}
layout(dimension: DOM.Dimension, shadowElement?: HTMLElement, position?: DOM.IDomPosition): void {
if (!shadowElement && this._shadowElementViewInfo === null) {
this._dimension = dimension;
@ -1802,7 +1806,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
this._dimension = dimension;
this._position = position;
const newBodyHeight = Math.max(dimension.height - (this._notebookTopToolbar?.useGlobalToolbar ? /** Toolbar height */ 26 : 0), 0);
const newBodyHeight = this.getBodyHeight(dimension.height);
DOM.size(this._body, dimension.width, newBodyHeight);
const topInserToolbarHeight = this._notebookOptions.computeTopInsertToolbarHeight(this.viewModel?.viewType);