1 | import { ISessionContext, ISessionContextDialogs } from '@jupyterlab/apputils';
|
2 | import { Cell } from '@jupyterlab/cells';
|
3 | import * as nbformat from '@jupyterlab/nbformat';
|
4 | import { KernelMessage } from '@jupyterlab/services';
|
5 | import { ITranslator } from '@jupyterlab/translation';
|
6 | import { ISignal } from '@lumino/signaling';
|
7 | import { Notebook, StaticNotebook } from './widget';
|
8 | import { INotebookCellExecutor } from './tokens';
|
9 | export declare class KernelError extends Error {
|
10 | /**
|
11 | * Exception name
|
12 | */
|
13 | readonly errorName: string;
|
14 | /**
|
15 | * Exception value
|
16 | */
|
17 | readonly errorValue: string;
|
18 | /**
|
19 | * Traceback
|
20 | */
|
21 | readonly traceback: string[];
|
22 | /**
|
23 | * Construct the kernel error.
|
24 | */
|
25 | constructor(content: KernelMessage.IExecuteReplyMsg['content']);
|
26 | }
|
27 | /**
|
28 | * A collection of actions that run against notebooks.
|
29 | *
|
30 | * #### Notes
|
31 | * All of the actions are a no-op if there is no model on the notebook.
|
32 | * The actions set the widget `mode` to `'command'` unless otherwise specified.
|
33 | * The actions will preserve the selection on the notebook widget unless
|
34 | * otherwise specified.
|
35 | */
|
36 | export declare class NotebookActions {
|
37 | /**
|
38 | * A signal that emits whenever a cell completes execution.
|
39 | */
|
40 | static get executed(): ISignal<any, {
|
41 | notebook: Notebook;
|
42 | cell: Cell;
|
43 | success: boolean;
|
44 | error?: KernelError | null;
|
45 | }>;
|
46 | /**
|
47 | * A signal that emits whenever a cell execution is scheduled.
|
48 | */
|
49 | static get executionScheduled(): ISignal<any, {
|
50 | notebook: Notebook;
|
51 | cell: Cell;
|
52 | }>;
|
53 | /**
|
54 | * A signal that emits when one notebook's cells are all executed.
|
55 | */
|
56 | static get selectionExecuted(): ISignal<any, {
|
57 | notebook: Notebook;
|
58 | lastCell: Cell;
|
59 | }>;
|
60 | /**
|
61 | * A signal that emits when a cell's output is cleared.
|
62 | */
|
63 | static get outputCleared(): ISignal<any, {
|
64 | notebook: Notebook;
|
65 | cell: Cell;
|
66 | }>;
|
67 | /**
|
68 | * A private constructor for the `NotebookActions` class.
|
69 | *
|
70 | * #### Notes
|
71 | * This class can never be instantiated. Its static member `executed` will be
|
72 | * merged with the `NotebookActions` namespace. The reason it exists as a
|
73 | * standalone class is because at run time, the `Private.executed` variable
|
74 | * does not yet exist, so it needs to be referenced via a getter.
|
75 | */
|
76 | private constructor();
|
77 | }
|
78 | /**
|
79 | * A namespace for `NotebookActions` static methods.
|
80 | */
|
81 | export declare namespace NotebookActions {
|
82 | /**
|
83 | * Split the active cell into two or more cells.
|
84 | *
|
85 | * @param notebook The target notebook widget.
|
86 | *
|
87 | * #### Notes
|
88 | * It will preserve the existing mode.
|
89 | * The last cell will be activated if no selection is found.
|
90 | * If text was selected, the cell containing the selection will
|
91 | * be activated.
|
92 | * The existing selection will be cleared.
|
93 | * The activated cell will have focus and the cursor will
|
94 | * remain in the initial position.
|
95 | * The leading whitespace in the second cell will be removed.
|
96 | * If there is no content, two empty cells will be created.
|
97 | * Both cells will have the same type as the original cell.
|
98 | * This action can be undone.
|
99 | */
|
100 | function splitCell(notebook: Notebook): void;
|
101 | /**
|
102 | * Merge the selected cells.
|
103 | *
|
104 | * @param notebook - The target notebook widget.
|
105 | *
|
106 | * @param mergeAbove - If only one cell is selected, indicates whether to merge it
|
107 | * with the cell above (true) or below (false, default).
|
108 | *
|
109 | * #### Notes
|
110 | * The widget mode will be preserved.
|
111 | * If only one cell is selected and `mergeAbove` is true, the above cell will be selected.
|
112 | * If only one cell is selected and `mergeAbove` is false, the below cell will be selected.
|
113 | * If the active cell is a code cell, its outputs will be cleared.
|
114 | * This action can be undone.
|
115 | * The final cell will have the same type as the active cell.
|
116 | * If the active cell is a markdown cell, it will be unrendered.
|
117 | */
|
118 | function mergeCells(notebook: Notebook, mergeAbove?: boolean): void;
|
119 | /**
|
120 | * Delete the selected cells.
|
121 | *
|
122 | * @param notebook - The target notebook widget.
|
123 | *
|
124 | * #### Notes
|
125 | * The cell after the last selected cell will be activated.
|
126 | * It will add a code cell if all cells are deleted.
|
127 | * This action can be undone.
|
128 | */
|
129 | function deleteCells(notebook: Notebook): void;
|
130 | /**
|
131 | * Insert a new code cell above the active cell or in index 0 if the notebook is empty.
|
132 | *
|
133 | * @param notebook - The target notebook widget.
|
134 | *
|
135 | * #### Notes
|
136 | * The widget mode will be preserved.
|
137 | * This action can be undone.
|
138 | * The existing selection will be cleared.
|
139 | * The new cell will the active cell.
|
140 | */
|
141 | function insertAbove(notebook: Notebook): void;
|
142 | /**
|
143 | * Insert a new code cell below the active cell or in index 0 if the notebook is empty.
|
144 | *
|
145 | * @param notebook - The target notebook widget.
|
146 | *
|
147 | * #### Notes
|
148 | * The widget mode will be preserved.
|
149 | * This action can be undone.
|
150 | * The existing selection will be cleared.
|
151 | * The new cell will be the active cell.
|
152 | */
|
153 | function insertBelow(notebook: Notebook): void;
|
154 | /**
|
155 | * Move the selected cell(s) down.
|
156 | *
|
157 | * @param notebook = The target notebook widget.
|
158 | */
|
159 | function moveDown(notebook: Notebook): void;
|
160 | /**
|
161 | * Move the selected cell(s) up.
|
162 | *
|
163 | * @param notebook - The target notebook widget.
|
164 | */
|
165 | function moveUp(notebook: Notebook): void;
|
166 | /**
|
167 | * Change the selected cell type(s).
|
168 | *
|
169 | * @param notebook - The target notebook widget.
|
170 | * @param value - The target cell type.
|
171 | * @param translator - The application translator.
|
172 | *
|
173 | * #### Notes
|
174 | * It should preserve the widget mode.
|
175 | * This action can be undone.
|
176 | * The existing selection will be cleared.
|
177 | * Any cells converted to markdown will be unrendered.
|
178 | */
|
179 | function changeCellType(notebook: Notebook, value: nbformat.CellType, translator?: ITranslator): void;
|
180 | /**
|
181 | * Run the selected cell(s).
|
182 | *
|
183 | * @param notebook - The target notebook widget.
|
184 | * @param sessionContext - The client session object.
|
185 | * @param sessionDialogs - The session dialogs.
|
186 | * @param translator - The application translator.
|
187 | *
|
188 | * #### Notes
|
189 | * The last selected cell will be activated, but not scrolled into view.
|
190 | * The existing selection will be cleared.
|
191 | * An execution error will prevent the remaining code cells from executing.
|
192 | * All markdown cells will be rendered.
|
193 | */
|
194 | function run(notebook: Notebook, sessionContext?: ISessionContext, sessionDialogs?: ISessionContextDialogs, translator?: ITranslator): Promise<boolean>;
|
195 | /**
|
196 | * Run specified cells.
|
197 | *
|
198 | * @param notebook - The target notebook widget.
|
199 | * @param cells - The cells to run.
|
200 | * @param sessionContext - The client session object.
|
201 | * @param sessionDialogs - The session dialogs.
|
202 | * @param translator - The application translator.
|
203 | *
|
204 | * #### Notes
|
205 | * The existing selection will be preserved.
|
206 | * The mode will be changed to command.
|
207 | * An execution error will prevent the remaining code cells from executing.
|
208 | * All markdown cells will be rendered.
|
209 | */
|
210 | function runCells(notebook: Notebook, cells: readonly Cell[], sessionContext?: ISessionContext, sessionDialogs?: ISessionContextDialogs, translator?: ITranslator): Promise<boolean>;
|
211 | /**
|
212 | * Run the selected cell(s) and advance to the next cell.
|
213 | *
|
214 | * @param notebook - The target notebook widget.
|
215 | * @param sessionContext - The client session object.
|
216 | * @param sessionDialogs - The session dialogs.
|
217 | * @param translator - The application translator.
|
218 | *
|
219 | * #### Notes
|
220 | * The existing selection will be cleared.
|
221 | * The cell after the last selected cell will be activated and scrolled into view.
|
222 | * An execution error will prevent the remaining code cells from executing.
|
223 | * All markdown cells will be rendered.
|
224 | * If the last selected cell is the last cell, a new code cell
|
225 | * will be created in `'edit'` mode. The new cell creation can be undone.
|
226 | */
|
227 | function runAndAdvance(notebook: Notebook, sessionContext?: ISessionContext, sessionDialogs?: ISessionContextDialogs, translator?: ITranslator): Promise<boolean>;
|
228 | /**
|
229 | * Run the selected cell(s) and insert a new code cell.
|
230 | *
|
231 | * @param notebook - The target notebook widget.
|
232 | * @param sessionContext - The client session object.
|
233 | * @param sessionDialogs - The session dialogs.
|
234 | * @param translator - The application translator.
|
235 | *
|
236 | * #### Notes
|
237 | * An execution error will prevent the remaining code cells from executing.
|
238 | * All markdown cells will be rendered.
|
239 | * The widget mode will be set to `'edit'` after running.
|
240 | * The existing selection will be cleared.
|
241 | * The cell insert can be undone.
|
242 | * The new cell will be scrolled into view.
|
243 | */
|
244 | function runAndInsert(notebook: Notebook, sessionContext?: ISessionContext, sessionDialogs?: ISessionContextDialogs, translator?: ITranslator): Promise<boolean>;
|
245 | /**
|
246 | * Run all of the cells in the notebook.
|
247 | *
|
248 | * @param notebook - The target notebook widget.
|
249 | * @param sessionContext - The client session object.
|
250 | * @param sessionDialogs - The session dialogs.
|
251 | * @param translator - The application translator.
|
252 | *
|
253 | * #### Notes
|
254 | * The existing selection will be cleared.
|
255 | * An execution error will prevent the remaining code cells from executing.
|
256 | * All markdown cells will be rendered.
|
257 | * The last cell in the notebook will be activated and scrolled into view.
|
258 | */
|
259 | function runAll(notebook: Notebook, sessionContext?: ISessionContext, sessionDialogs?: ISessionContextDialogs, translator?: ITranslator): Promise<boolean>;
|
260 | function renderAllMarkdown(notebook: Notebook): Promise<boolean>;
|
261 | /**
|
262 | * Run all of the cells before the currently active cell (exclusive).
|
263 | *
|
264 | * @param notebook - The target notebook widget.
|
265 | * @param sessionContext - The client session object.
|
266 | * @param sessionDialogs - The session dialogs.
|
267 | * @param translator - The application translator.
|
268 | *
|
269 | * #### Notes
|
270 | * The existing selection will be cleared.
|
271 | * An execution error will prevent the remaining code cells from executing.
|
272 | * All markdown cells will be rendered.
|
273 | * The currently active cell will remain selected.
|
274 | */
|
275 | function runAllAbove(notebook: Notebook, sessionContext?: ISessionContext, sessionDialogs?: ISessionContextDialogs, translator?: ITranslator): Promise<boolean>;
|
276 | /**
|
277 | * Run all of the cells after the currently active cell (inclusive).
|
278 | *
|
279 | * @param notebook - The target notebook widget.
|
280 | * @param sessionContext - The client session object.
|
281 | * @param sessionDialogs - The session dialogs.
|
282 | * @param translator - The application translator.
|
283 | *
|
284 | * #### Notes
|
285 | * The existing selection will be cleared.
|
286 | * An execution error will prevent the remaining code cells from executing.
|
287 | * All markdown cells will be rendered.
|
288 | * The last cell in the notebook will be activated and scrolled into view.
|
289 | */
|
290 | function runAllBelow(notebook: Notebook, sessionContext?: ISessionContext, sessionDialogs?: ISessionContextDialogs, translator?: ITranslator): Promise<boolean>;
|
291 | /**
|
292 | * Replaces the selection in the active cell of the notebook.
|
293 | *
|
294 | * @param notebook - The target notebook widget.
|
295 | * @param text - The text to replace the selection.
|
296 | */
|
297 | function replaceSelection(notebook: Notebook, text: string): void;
|
298 | /**
|
299 | * Select the above the active cell.
|
300 | *
|
301 | * @param notebook - The target notebook widget.
|
302 | *
|
303 | * #### Notes
|
304 | * The widget mode will be preserved.
|
305 | * This is a no-op if the first cell is the active cell.
|
306 | * This will skip any collapsed cells.
|
307 | * The existing selection will be cleared.
|
308 | */
|
309 | function selectAbove(notebook: Notebook): void;
|
310 | /**
|
311 | * Select the cell below the active cell.
|
312 | *
|
313 | * @param notebook - The target notebook widget.
|
314 | *
|
315 | * #### Notes
|
316 | * The widget mode will be preserved.
|
317 | * This is a no-op if the last cell is the active cell.
|
318 | * This will skip any collapsed cells.
|
319 | * The existing selection will be cleared.
|
320 | */
|
321 | function selectBelow(notebook: Notebook): void;
|
322 | /** Insert new heading of same level above active cell.
|
323 | *
|
324 | * @param notebook - The target notebook widget
|
325 | */
|
326 | function insertSameLevelHeadingAbove(notebook: Notebook): Promise<void>;
|
327 | /** Insert new heading of same level at end of current section.
|
328 | *
|
329 | * @param notebook - The target notebook widget
|
330 | */
|
331 | function insertSameLevelHeadingBelow(notebook: Notebook): Promise<void>;
|
332 | /**
|
333 | * Select the heading above the active cell or, if already at heading, collapse it.
|
334 | *
|
335 | * @param notebook - The target notebook widget.
|
336 | *
|
337 | * #### Notes
|
338 | * The widget mode will be preserved.
|
339 | * This is a no-op if the active cell is the topmost heading in collapsed state
|
340 | * The existing selection will be cleared.
|
341 | */
|
342 | function selectHeadingAboveOrCollapseHeading(notebook: Notebook): void;
|
343 | /**
|
344 | * Select the heading below the active cell or, if already at heading, expand it.
|
345 | *
|
346 | * @param notebook - The target notebook widget.
|
347 | *
|
348 | * #### Notes
|
349 | * The widget mode will be preserved.
|
350 | * This is a no-op if the active cell is the last heading in expanded state
|
351 | * The existing selection will be cleared.
|
352 | */
|
353 | function selectHeadingBelowOrExpandHeading(notebook: Notebook): void;
|
354 | /**
|
355 | * Extend the selection to the cell above.
|
356 | *
|
357 | * @param notebook - The target notebook widget.
|
358 | * @param toTop - If true, denotes selection to extend to the top.
|
359 | *
|
360 | * #### Notes
|
361 | * This is a no-op if the first cell is the active cell.
|
362 | * The new cell will be activated.
|
363 | */
|
364 | function extendSelectionAbove(notebook: Notebook, toTop?: boolean): void;
|
365 | /**
|
366 | * Extend the selection to the cell below.
|
367 | *
|
368 | * @param notebook - The target notebook widget.
|
369 | * @param toBottom - If true, denotes selection to extend to the bottom.
|
370 | *
|
371 | * #### Notes
|
372 | * This is a no-op if the last cell is the active cell.
|
373 | * The new cell will be activated.
|
374 | */
|
375 | function extendSelectionBelow(notebook: Notebook, toBottom?: boolean): void;
|
376 | /**
|
377 | * Select all of the cells of the notebook.
|
378 | *
|
379 | * @param notebook - the target notebook widget.
|
380 | */
|
381 | function selectAll(notebook: Notebook): void;
|
382 | /**
|
383 | * Deselect all of the cells of the notebook.
|
384 | *
|
385 | * @param notebook - the target notebook widget.
|
386 | */
|
387 | function deselectAll(notebook: Notebook): void;
|
388 | /**
|
389 | * Copy the selected cell(s) data to a clipboard.
|
390 | *
|
391 | * @param notebook - The target notebook widget.
|
392 | */
|
393 | function copy(notebook: Notebook): void;
|
394 | /**
|
395 | * Cut the selected cell data to a clipboard.
|
396 | *
|
397 | * @param notebook - The target notebook widget.
|
398 | *
|
399 | * #### Notes
|
400 | * This action can be undone.
|
401 | * A new code cell is added if all cells are cut.
|
402 | */
|
403 | function cut(notebook: Notebook): void;
|
404 | /**
|
405 | * Paste cells from the application clipboard.
|
406 | *
|
407 | * @param notebook - The target notebook widget.
|
408 | *
|
409 | * @param mode - the mode of adding cells:
|
410 | * 'below' (default) adds cells below the active cell,
|
411 | * 'belowSelected' adds cells below all selected cells,
|
412 | * 'above' adds cells above the active cell, and
|
413 | * 'replace' removes the currently selected cells and adds cells in their place.
|
414 | *
|
415 | * #### Notes
|
416 | * The last pasted cell becomes the active cell.
|
417 | * This is a no-op if there is no cell data on the clipboard.
|
418 | * This action can be undone.
|
419 | */
|
420 | function paste(notebook: Notebook, mode?: 'below' | 'belowSelected' | 'above' | 'replace'): void;
|
421 | /**
|
422 | * Duplicate selected cells in the notebook without using the application clipboard.
|
423 | *
|
424 | * @param notebook - The target notebook widget.
|
425 | *
|
426 | * @param mode - the mode of adding cells:
|
427 | * 'below' (default) adds cells below the active cell,
|
428 | * 'belowSelected' adds cells below all selected cells,
|
429 | * 'above' adds cells above the active cell, and
|
430 | * 'replace' removes the currently selected cells and adds cells in their place.
|
431 | *
|
432 | * #### Notes
|
433 | * The last pasted cell becomes the active cell.
|
434 | * This is a no-op if there is no cell data on the clipboard.
|
435 | * This action can be undone.
|
436 | */
|
437 | function duplicate(notebook: Notebook, mode?: 'below' | 'belowSelected' | 'above' | 'replace'): void;
|
438 | /**
|
439 | * Undo a cell action.
|
440 | *
|
441 | * @param notebook - The target notebook widget.
|
442 | *
|
443 | * #### Notes
|
444 | * This is a no-op if there are no cell actions to undo.
|
445 | */
|
446 | function undo(notebook: Notebook): void;
|
447 | /**
|
448 | * Redo a cell action.
|
449 | *
|
450 | * @param notebook - The target notebook widget.
|
451 | *
|
452 | * #### Notes
|
453 | * This is a no-op if there are no cell actions to redo.
|
454 | */
|
455 | function redo(notebook: Notebook): void;
|
456 | /**
|
457 | * Toggle the line number of all cells.
|
458 | *
|
459 | * @param notebook - The target notebook widget.
|
460 | *
|
461 | * #### Notes
|
462 | * The original state is based on the state of the active cell.
|
463 | * The `mode` of the widget will be preserved.
|
464 | */
|
465 | function toggleAllLineNumbers(notebook: Notebook): void;
|
466 | /**
|
467 | * Clear the code outputs of the selected cells.
|
468 | *
|
469 | * @param notebook - The target notebook widget.
|
470 | *
|
471 | * #### Notes
|
472 | * The widget `mode` will be preserved.
|
473 | */
|
474 | function clearOutputs(notebook: Notebook): void;
|
475 | /**
|
476 | * Clear all the code outputs on the widget.
|
477 | *
|
478 | * @param notebook - The target notebook widget.
|
479 | *
|
480 | * #### Notes
|
481 | * The widget `mode` will be preserved.
|
482 | */
|
483 | function clearAllOutputs(notebook: Notebook): void;
|
484 | /**
|
485 | * Hide the code on selected code cells.
|
486 | *
|
487 | * @param notebook - The target notebook widget.
|
488 | */
|
489 | function hideCode(notebook: Notebook): void;
|
490 | /**
|
491 | * Show the code on selected code cells.
|
492 | *
|
493 | * @param notebook - The target notebook widget.
|
494 | */
|
495 | function showCode(notebook: Notebook): void;
|
496 | /**
|
497 | * Hide the code on all code cells.
|
498 | *
|
499 | * @param notebook - The target notebook widget.
|
500 | */
|
501 | function hideAllCode(notebook: Notebook): void;
|
502 | /**
|
503 | * Show the code on all code cells.
|
504 | *
|
505 | * @param notebook The target notebook widget.
|
506 | */
|
507 | function showAllCode(notebook: Notebook): void;
|
508 | /**
|
509 | * Hide the output on selected code cells.
|
510 | *
|
511 | * @param notebook - The target notebook widget.
|
512 | */
|
513 | function hideOutput(notebook: Notebook): void;
|
514 | /**
|
515 | * Show the output on selected code cells.
|
516 | *
|
517 | * @param notebook - The target notebook widget.
|
518 | */
|
519 | function showOutput(notebook: Notebook): void;
|
520 | /**
|
521 | * Toggle output visibility on selected code cells.
|
522 | * If at least one output is visible, all outputs are hidden.
|
523 | * If no outputs are visible, all outputs are made visible.
|
524 | *
|
525 | * @param notebook - The target notebook widget.
|
526 | */
|
527 | function toggleOutput(notebook: Notebook): void;
|
528 | /**
|
529 | * Hide the output on all code cells.
|
530 | *
|
531 | * @param notebook - The target notebook widget.
|
532 | */
|
533 | function hideAllOutputs(notebook: Notebook): void;
|
534 | /**
|
535 | * Render side-by-side.
|
536 | *
|
537 | * @param notebook - The target notebook widget.
|
538 | */
|
539 | function renderSideBySide(notebook: Notebook): void;
|
540 | /**
|
541 | * Render not side-by-side.
|
542 | *
|
543 | * @param notebook - The target notebook widget.
|
544 | */
|
545 | function renderDefault(notebook: Notebook): void;
|
546 | /**
|
547 | * Show the output on all code cells.
|
548 | *
|
549 | * @param notebook - The target notebook widget.
|
550 | */
|
551 | function showAllOutputs(notebook: Notebook): void;
|
552 | /**
|
553 | * Enable output scrolling for all selected cells.
|
554 | *
|
555 | * @param notebook - The target notebook widget.
|
556 | */
|
557 | function enableOutputScrolling(notebook: Notebook): void;
|
558 | /**
|
559 | * Disable output scrolling for all selected cells.
|
560 | *
|
561 | * @param notebook - The target notebook widget.
|
562 | */
|
563 | function disableOutputScrolling(notebook: Notebook): void;
|
564 | /**
|
565 | * Go to the last cell that is run or current if it is running.
|
566 | *
|
567 | * Note: This requires execution timing to be toggled on or this will have
|
568 | * no effect.
|
569 | *
|
570 | * @param notebook - The target notebook widget.
|
571 | */
|
572 | function selectLastRunCell(notebook: Notebook): void;
|
573 | /**
|
574 | * Set the markdown header level.
|
575 | *
|
576 | * @param notebook - The target notebook widget.
|
577 | * @param level - The header level.
|
578 | * @param translator - The application translator.
|
579 | *
|
580 | * #### Notes
|
581 | * All selected cells will be switched to markdown.
|
582 | * The level will be clamped between 1 and 6.
|
583 | * If there is an existing header, it will be replaced.
|
584 | * There will always be one blank space after the header.
|
585 | * The cells will be unrendered.
|
586 | */
|
587 | function setMarkdownHeader(notebook: Notebook, level: number, translator?: ITranslator): void;
|
588 | /**
|
589 | * Collapse all cells in given notebook.
|
590 | *
|
591 | * @param notebook - The target notebook widget.
|
592 | */
|
593 | function collapseAllHeadings(notebook: Notebook): any;
|
594 | /**
|
595 | * Un-collapse all cells in given notebook.
|
596 | *
|
597 | * @param notebook - The target notebook widget.
|
598 | */
|
599 | function expandAllHeadings(notebook: Notebook): any;
|
600 | /**
|
601 | * Finds the "parent" heading of the given cell and expands.
|
602 | * Used for the case that a cell becomes active that is within a collapsed heading.
|
603 | * @param cell - "Child" cell that has become the active cell
|
604 | * @param notebook - The target notebook widget.
|
605 | */
|
606 | function expandParent(cell: Cell, notebook: Notebook): void;
|
607 | /**
|
608 | * Finds the next heading that isn't a child of the given markdown heading.
|
609 | * @param cell - "Child" cell that has become the active cell
|
610 | * @param notebook - The target notebook widget.
|
611 | */
|
612 | function findNextParentHeading(cell: Cell, notebook: Notebook): number;
|
613 | /**
|
614 | * Set the given cell and ** all "child" cells **
|
615 | * to the given collapse / expand if cell is
|
616 | * a markdown header.
|
617 | *
|
618 | * @param cell - The cell
|
619 | * @param collapsing - Whether to collapse or expand the cell
|
620 | * @param notebook - The target notebook widget.
|
621 | */
|
622 | function setHeadingCollapse(cell: Cell, collapsing: boolean, notebook: StaticNotebook): number;
|
623 | /**
|
624 | * Toggles the collapse state of the active cell of the given notebook
|
625 | * and ** all of its "child" cells ** if the cell is a heading.
|
626 | *
|
627 | * @param notebook - The target notebook widget.
|
628 | */
|
629 | function toggleCurrentHeadingCollapse(notebook: Notebook): any;
|
630 | /**
|
631 | * If cell is a markdown heading, sets the headingCollapsed field,
|
632 | * and otherwise hides the cell.
|
633 | *
|
634 | * @param cell - The cell to collapse / expand
|
635 | * @param collapsing - Whether to collapse or expand the given cell
|
636 | */
|
637 | function setCellCollapse(cell: Cell, collapsing: boolean): any;
|
638 | /**
|
639 | * If given cell is a markdown heading, returns the heading level.
|
640 | * If given cell is not markdown, returns 7 (there are only 6 levels of markdown headings)
|
641 | *
|
642 | * @param cell - The target cell widget.
|
643 | */
|
644 | function getHeadingInfo(cell: Cell): {
|
645 | isHeading: boolean;
|
646 | headingLevel: number;
|
647 | collapsed?: boolean;
|
648 | };
|
649 | /**
|
650 | * Trust the notebook after prompting the user.
|
651 | *
|
652 | * @param notebook - The target notebook widget.
|
653 | * @param translator - The application translator.
|
654 | *
|
655 | * @returns a promise that resolves when the transaction is finished.
|
656 | *
|
657 | * #### Notes
|
658 | * No dialog will be presented if the notebook is already trusted.
|
659 | */
|
660 | function trust(notebook: Notebook, translator?: ITranslator): Promise<void>;
|
661 | /**
|
662 | * If the notebook has an active cell, focus it.
|
663 | *
|
664 | * @param notebook The target notebook widget
|
665 | * @param options Optional options to change the behavior of this function
|
666 | * @param options.waitUntilReady If true, do not call focus until activeCell.ready is resolved
|
667 | * @param options.preventScroll If true, do not scroll the active cell into view
|
668 | *
|
669 | * @returns a promise that resolves when focus has been called on the active
|
670 | * cell's node.
|
671 | *
|
672 | * #### Notes
|
673 | * By default, waits until after the active cell has been attached unless
|
674 | * called with { waitUntilReady: false }
|
675 | */
|
676 | function focusActiveCell(notebook: Notebook, options?: {
|
677 | waitUntilReady?: boolean;
|
678 | preventScroll?: boolean;
|
679 | }): Promise<void>;
|
680 | function accessPreviousHistory(notebook: Notebook): Promise<void>;
|
681 | /**
|
682 | * Access next notebook history.
|
683 | *
|
684 | * @param notebook - The target notebook widget.
|
685 | */
|
686 | function accessNextHistory(notebook: Notebook): Promise<void>;
|
687 | }
|
688 | /**
|
689 | * Set the notebook cell executor and the related signals.
|
690 | */
|
691 | export declare function setCellExecutor(executor: INotebookCellExecutor): void;
|