@@ -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
0 commit comments