@@ -45,6 +45,7 @@ import { NotebookInlineVariablesController } from '../contrib/notebookVariables/
4545const CLEAR_ALL_CELLS_OUTPUTS_COMMAND_ID = 'notebook.clearAllCellsOutputs' ;
4646const EDIT_CELL_COMMAND_ID = 'notebook.cell.edit' ;
4747const DELETE_CELL_COMMAND_ID = 'notebook.cell.delete' ;
48+ const QUIT_EDIT_ALL_CELLS_COMMAND_ID = 'notebook.quitEditAllCells' ;
4849export const CLEAR_CELL_OUTPUTS_COMMAND_ID = 'notebook.cell.clearOutputs' ;
4950export const SELECT_NOTEBOOK_INDENTATION_ID = 'notebook.selectIndentation' ;
5051export const COMMENT_SELECTED_CELLS_ID = 'notebook.commentSelectedCells' ;
@@ -151,6 +152,41 @@ registerAction2(class QuitEditCellAction extends NotebookCellAction {
151152 }
152153} ) ;
153154
155+ registerAction2 ( class QuitEditAllCellsAction extends NotebookAction {
156+ constructor ( ) {
157+ super (
158+ {
159+ id : QUIT_EDIT_ALL_CELLS_COMMAND_ID ,
160+ title : localize ( 'notebookActions.quitEditAllCells' , "Stop Editing All Cells" )
161+ } ) ;
162+ }
163+
164+ async runWithContext ( accessor : ServicesAccessor , context : INotebookActionContext ) {
165+ if ( ! context . notebookEditor . hasModel ( ) ) {
166+ return ;
167+ }
168+
169+ const viewModel = context . notebookEditor . getViewModel ( ) ;
170+ if ( ! viewModel ) {
171+ return ;
172+ }
173+
174+ const activeCell = context . notebookEditor . getActiveCell ( ) ;
175+
176+ const editingCells = viewModel . viewCells . filter ( cell =>
177+ cell . cellKind === CellKind . Markup && cell . getEditState ( ) === CellEditState . Editing
178+ ) ;
179+
180+ editingCells . forEach ( cell => {
181+ cell . updateEditState ( CellEditState . Preview , QUIT_EDIT_ALL_CELLS_COMMAND_ID ) ;
182+ } ) ;
183+
184+ if ( activeCell ) {
185+ await context . notebookEditor . focusNotebookCell ( activeCell , 'container' , { skipReveal : true } ) ;
186+ }
187+ }
188+ } ) ;
189+
154190registerAction2 ( class DeleteCellAction extends NotebookCellAction {
155191 constructor ( ) {
156192 super (
0 commit comments