提交 d1164661 编写于 作者: M Matt Bierner

Fix markdown edited cell height on reload

Fixes #118581

Make sure we don't update a markdown cell's height based on the preview if only the editor is visible
上级 c77e5ccd
......@@ -75,7 +75,9 @@ class BuiltinMarkdownRenderer extends Disposable implements IMarkdownRenderStrat
} else {
this.localDisposables.clear();
this.localDisposables.add(markdownRenderer.onDidRenderAsync(() => {
this.viewCell.renderedMarkdownHeight = this.container.clientHeight;
if (this.viewCell.editState === CellEditState.Preview) {
this.viewCell.renderedMarkdownHeight = this.container.clientHeight;
}
this.relayoutCell();
}));
......
......@@ -11,7 +11,7 @@ import * as nls from 'vs/nls';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { BOTTOM_CELL_TOOLBAR_GAP, BOTTOM_CELL_TOOLBAR_HEIGHT, CELL_MARGIN, CODE_CELL_LEFT_MARGIN, COLLAPSED_INDICATOR_HEIGHT, MARKDOWN_CELL_BOTTOM_MARGIN, MARKDOWN_CELL_TOP_MARGIN } from 'vs/workbench/contrib/notebook/browser/constants';
import { EditorFoldingStateDelegate } from 'vs/workbench/contrib/notebook/browser/contrib/fold/foldingModel';
import { CellFindMatch, ICellOutputViewModel, ICellViewModel, MarkdownCellLayoutChangeEvent, MarkdownCellLayoutInfo, NotebookLayoutInfo } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
import { CellEditState, CellFindMatch, ICellOutputViewModel, ICellViewModel, MarkdownCellLayoutChangeEvent, MarkdownCellLayoutInfo, NotebookLayoutInfo } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
import { MarkdownRenderer } from 'vs/editor/browser/core/markdownRenderer';
import { BaseCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/baseCellViewModel';
import { NotebookCellStateChangedEvent, NotebookEventDispatcher } from 'vs/workbench/contrib/notebook/browser/viewModel/eventDispatcher';
......@@ -28,8 +28,10 @@ export class MarkdownCellViewModel extends BaseCellViewModel implements ICellVie
}
set renderedMarkdownHeight(newHeight: number) {
const newTotalHeight = newHeight + BOTTOM_CELL_TOOLBAR_GAP;
this.totalHeight = newTotalHeight;
if (this.editState === CellEditState.Preview) {
const newTotalHeight = newHeight + BOTTOM_CELL_TOOLBAR_GAP;
this.totalHeight = newTotalHeight;
}
}
private set totalHeight(newHeight: number) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册