Skip to content

Commit 08f8499

Browse files
committed
1 parent cea1d2f commit 08f8499

2 files changed

Lines changed: 17 additions & 11 deletions

File tree

src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,23 @@ export class MarkdownCellRenderer extends AbstractCellRenderer implements IListR
394394
if (height) {
395395
const elementDisposables = templateData.elementDisposables;
396396

397+
// render toolbar first
398+
const contextKeyService = this.contextKeyService.createScoped(templateData.container);
399+
this.setupCellToolbarActions(contextKeyService, templateData, elementDisposables);
400+
401+
const toolbarContext = <INotebookCellActionContext>{
402+
cell: element,
403+
notebookEditor: this.notebookEditor,
404+
$mid: 12
405+
};
406+
templateData.toolbar.context = toolbarContext;
407+
408+
this.setupBetweenCellToolbarActions(element, templateData, elementDisposables, toolbarContext);
409+
397410
const markdownCell = new StatefullMarkdownCell(this.notebookEditor, element, templateData, this.editorOptions.value, this.instantiationService);
398411
elementDisposables.add(this.editorOptions.onDidChange(newValue => markdownCell.updateEditorOptions(newValue)));
399412
elementDisposables.add(markdownCell);
400413

401-
const contextKeyService = this.contextKeyService.createScoped(templateData.container);
402414
NOTEBOOK_CELL_TYPE.bindTo(contextKeyService).set('markdown');
403415
NOTEBOOK_VIEW_TYPE.bindTo(contextKeyService).set(element.viewType);
404416
const metadata = element.getEvaluatedMetadata(this.notebookEditor.viewModel!.notebookDocument.metadata);
@@ -424,16 +436,6 @@ export class MarkdownCellRenderer extends AbstractCellRenderer implements IListR
424436
}
425437
}));
426438

427-
this.setupCellToolbarActions(contextKeyService, templateData, elementDisposables);
428-
429-
const toolbarContext = <INotebookCellActionContext>{
430-
cell: element,
431-
notebookEditor: this.notebookEditor,
432-
$mid: 12
433-
};
434-
templateData.toolbar.context = toolbarContext;
435-
436-
this.setupBetweenCellToolbarActions(element, templateData, elementDisposables, toolbarContext);
437439
element.totalHeight = height;
438440
}
439441

src/vs/workbench/contrib/notebook/browser/view/renderers/markdownCell.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ export class StatefullMarkdownCell extends Disposable {
149149
this.markdownContainer.appendChild(renderedHTML);
150150
}
151151
}));
152+
153+
const clientHeight = templateData.container.clientHeight;
154+
this.viewCell.totalHeight = clientHeight;
155+
notebookEditor.layoutNotebookCell(viewCell, clientHeight);
152156
}
153157
}
154158
};

0 commit comments

Comments
 (0)