mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
Align Cell Markup/Markdown (#157289)
This commit is contained in:
@@ -225,7 +225,7 @@ export class FindModel extends Disposable {
|
||||
return;
|
||||
}
|
||||
|
||||
// the cell is a markdown cell in editing mode or a code cell, both should have monaco editor rendered
|
||||
// the cell is a markup cell in editing mode or a code cell, both should have monaco editor rendered
|
||||
|
||||
if (!this._currentMatchDecorations) {
|
||||
// no current highlight decoration
|
||||
|
||||
@@ -180,7 +180,7 @@ export interface CodeCellLayoutChangeEvent {
|
||||
font?: FontInfo;
|
||||
}
|
||||
|
||||
export interface MarkdownCellLayoutInfo {
|
||||
export interface MarkupCellLayoutInfo {
|
||||
readonly fontInfo: FontInfo | null;
|
||||
readonly editorWidth: number;
|
||||
readonly editorHeight: number;
|
||||
@@ -196,7 +196,7 @@ export enum CellLayoutContext {
|
||||
Fold
|
||||
}
|
||||
|
||||
export interface MarkdownCellLayoutChangeEvent {
|
||||
export interface MarkupCellLayoutChangeEvent {
|
||||
font?: FontInfo;
|
||||
outerWidth?: number;
|
||||
editorHeight?: number;
|
||||
|
||||
@@ -76,14 +76,12 @@ export class CellFocusIndicator extends CellPart {
|
||||
|
||||
override updateInternalLayoutNow(element: ICellViewModel): void {
|
||||
if (element.cellKind === CellKind.Markup) {
|
||||
// markdown cell
|
||||
const indicatorPostion = this.notebookEditor.notebookOptions.computeIndicatorPosition(element.layoutInfo.totalHeight, (element as MarkupCellViewModel).layoutInfo.foldHintHeight, this.notebookEditor.textModel?.viewType);
|
||||
this.bottom.domNode.style.transform = `translateY(${indicatorPostion.bottomIndicatorTop}px)`;
|
||||
this.left.setHeight(indicatorPostion.verticalIndicatorHeight);
|
||||
this.right.setHeight(indicatorPostion.verticalIndicatorHeight);
|
||||
this.codeFocusIndicator.setHeight(indicatorPostion.verticalIndicatorHeight - this.getIndicatorTopMargin() * 2);
|
||||
} else {
|
||||
// code cell
|
||||
const cell = element as CodeCellViewModel;
|
||||
const layoutInfo = this.notebookEditor.notebookOptions.getLayoutConfiguration();
|
||||
const bottomToolbarDimensions = this.notebookEditor.notebookOptions.computeBottomToolbarDimensions(this.notebookEditor.textModel?.viewType);
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ import { MarkdownCellRenderTemplate } from 'vs/workbench/contrib/notebook/browse
|
||||
import { MarkupCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/markupCellViewModel';
|
||||
import { INotebookCellStatusBarService } from 'vs/workbench/contrib/notebook/common/notebookCellStatusBarService';
|
||||
|
||||
export class StatefulMarkdownCell extends Disposable {
|
||||
export class MarkupCell extends Disposable {
|
||||
|
||||
private editor: CodeEditorWidget | null = null;
|
||||
|
||||
@@ -41,7 +41,7 @@ import { RunToolbar } from 'vs/workbench/contrib/notebook/browser/view/cellParts
|
||||
import { CollapsedCellInput } from 'vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellInput';
|
||||
import { CollapsedCellOutput } from 'vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellOutput';
|
||||
import { FoldedCellHint } from 'vs/workbench/contrib/notebook/browser/view/cellParts/foldedCellHint';
|
||||
import { StatefulMarkdownCell } from 'vs/workbench/contrib/notebook/browser/view/cellParts/markdownCell';
|
||||
import { MarkupCell } from 'vs/workbench/contrib/notebook/browser/view/cellParts/markupCell';
|
||||
import { CodeCellRenderTemplate, MarkdownCellRenderTemplate } from 'vs/workbench/contrib/notebook/browser/view/notebookRenderingCommon';
|
||||
import { CodeCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel';
|
||||
import { MarkupCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/markupCellViewModel';
|
||||
@@ -210,7 +210,7 @@ export class MarkupCellRenderer extends AbstractCellRenderer implements IListRen
|
||||
return;
|
||||
}
|
||||
|
||||
templateData.elementDisposables.add(templateData.instantiationService.createInstance(StatefulMarkdownCell, this.notebookEditor, element, templateData, this.renderedEditors));
|
||||
templateData.elementDisposables.add(templateData.instantiationService.createInstance(MarkupCell, this.notebookEditor, element, templateData, this.renderedEditors));
|
||||
}
|
||||
|
||||
disposeTemplate(templateData: MarkdownCellRenderTemplate): void {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Emitter, Event } from 'vs/base/common/event';
|
||||
import * as UUID from 'vs/base/common/uuid';
|
||||
import * as editorCommon from 'vs/editor/common/editorCommon';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { CellEditState, CellFindMatch, CellFoldingState, CellLayoutContext, CellLayoutState, EditorFoldingStateDelegate, ICellOutputViewModel, ICellViewModel, MarkdownCellLayoutChangeEvent, MarkdownCellLayoutInfo } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
|
||||
import { CellEditState, CellFindMatch, CellFoldingState, CellLayoutContext, CellLayoutState, EditorFoldingStateDelegate, ICellOutputViewModel, ICellViewModel, MarkupCellLayoutChangeEvent, MarkupCellLayoutInfo } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
|
||||
import { BaseCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/baseCellViewModel';
|
||||
import { NotebookCellTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookCellTextModel';
|
||||
import { CellKind, INotebookSearchOptions } from 'vs/workbench/contrib/notebook/common/notebookCommon';
|
||||
@@ -23,7 +23,7 @@ export class MarkupCellViewModel extends BaseCellViewModel implements ICellViewM
|
||||
|
||||
readonly cellKind = CellKind.Markup;
|
||||
|
||||
private _layoutInfo: MarkdownCellLayoutInfo;
|
||||
private _layoutInfo: MarkupCellLayoutInfo;
|
||||
|
||||
private _renderedHtml?: string;
|
||||
|
||||
@@ -58,7 +58,7 @@ export class MarkupCellViewModel extends BaseCellViewModel implements ICellViewM
|
||||
throw new Error('MarkdownCellViewModel.editorHeight is write only');
|
||||
}
|
||||
|
||||
protected readonly _onDidChangeLayout = this._register(new Emitter<MarkdownCellLayoutChangeEvent>());
|
||||
protected readonly _onDidChangeLayout = this._register(new Emitter<MarkupCellLayoutChangeEvent>());
|
||||
readonly onDidChangeLayout = this._onDidChangeLayout.event;
|
||||
|
||||
get foldingState() {
|
||||
@@ -185,7 +185,7 @@ export class MarkupCellViewModel extends BaseCellViewModel implements ICellViewM
|
||||
}
|
||||
}
|
||||
|
||||
layoutChange(state: MarkdownCellLayoutChangeEvent) {
|
||||
layoutChange(state: MarkupCellLayoutChangeEvent) {
|
||||
// recompute
|
||||
const foldHintHeight = this._computeFoldHintHeight();
|
||||
if (!this.isInputCollapsed) {
|
||||
|
||||
Reference in New Issue
Block a user