@@ -45,6 +45,7 @@ import { NotebookInlineVariablesController } from '../contrib/notebookVariables/
45
45
const CLEAR_ALL_CELLS_OUTPUTS_COMMAND_ID = 'notebook.clearAllCellsOutputs' ;
46
46
const EDIT_CELL_COMMAND_ID = 'notebook.cell.edit' ;
47
47
const DELETE_CELL_COMMAND_ID = 'notebook.cell.delete' ;
48
+ const QUIT_EDIT_ALL_CELLS_COMMAND_ID = 'notebook.quitEditAllCells' ;
48
49
export const CLEAR_CELL_OUTPUTS_COMMAND_ID = 'notebook.cell.clearOutputs' ;
49
50
export const SELECT_NOTEBOOK_INDENTATION_ID = 'notebook.selectIndentation' ;
50
51
export const COMMENT_SELECTED_CELLS_ID = 'notebook.commentSelectedCells' ;
@@ -151,6 +152,41 @@ registerAction2(class QuitEditCellAction extends NotebookCellAction {
151
152
}
152
153
} ) ;
153
154
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
+
154
190
registerAction2 ( class DeleteCellAction extends NotebookCellAction {
155
191
constructor ( ) {
156
192
super (
0 commit comments