This commit is contained in:
rebornix 2021-07-21 15:56:01 -07:00
parent c69945154d
commit dd33bf7dd6
3 changed files with 17 additions and 2 deletions

View file

@ -276,7 +276,7 @@ export class InteractiveEditor extends EditorPane {
} = this.#notebookOptions.getLayoutConfiguration();
const leftMargin = codeCellLeftMargin + cellRunGutter;
const maxHeight = Math.min(this.#dimension.height / 2, this._inputCellEditorHeight);
this.#codeEditorWidget.layout(new DOM.Dimension(this.#dimension.width - leftMargin - INPUT_CELL_HORIZONTAL_PADDING_RIGHT, maxHeight));
this.#codeEditorWidget.layout(this.#validateDimension(this.#dimension.width - leftMargin - INPUT_CELL_HORIZONTAL_PADDING_RIGHT, maxHeight));
this.#inputFocusIndicator.style.height = `${this._inputCellEditorHeight}px`;
this.#inputCellContainer.style.top = `${this.#dimension.height - this._inputCellContainerHeight}px`;
this.#inputCellContainer.style.width = `${this.#dimension.width}px`;
@ -508,12 +508,16 @@ export class InteractiveEditor extends EditorPane {
this.#notebookEditorContainer.style.height = `${dimension.height - inputCellContainerHeight}px`;
this.#notebookWidget.value!.layout(dimension.with(dimension.width, dimension.height - inputCellContainerHeight), this.#notebookEditorContainer);
this.#codeEditorWidget.layout(new DOM.Dimension(dimension.width - leftMargin - INPUT_CELL_HORIZONTAL_PADDING_RIGHT, maxHeight));
this.#codeEditorWidget.layout(this.#validateDimension(dimension.width - leftMargin - INPUT_CELL_HORIZONTAL_PADDING_RIGHT, maxHeight));
this.#inputFocusIndicator.style.height = `${contentHeight}px`;
this.#inputCellContainer.style.top = `${dimension.height - inputCellContainerHeight}px`;
this.#inputCellContainer.style.width = `${dimension.width}px`;
}
#validateDimension(width: number, height: number) {
return new DOM.Dimension(Math.max(0, width), Math.max(0, height));
}
#updateInputDecoration(): void {
if (!this.#codeEditorWidget) {
return;

View file

@ -196,6 +196,11 @@ export class NotebookEditorToolbar extends Disposable {
}
layout() {
if (!this._useGlobalToolbar) {
this.domNode.style.display = 'none';
} else {
this.domNode.style.display = 'flex';
}
this._updateScrollbar();
}

View file

@ -1540,6 +1540,11 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
return;
}
if (dimension.width <= 0 || dimension.height <= 0) {
this.onWillHide();
return;
}
if (shadowElement) {
const containerRect = shadowElement.getBoundingClientRect();
@ -1617,6 +1622,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
this._editorFocus.set(false);
this._overlayContainer.style.visibility = 'hidden';
this._overlayContainer.style.left = '-50000px';
this._notebookTopToolbarContainer.style.display = 'none';
}
updateEditorFocus() {