Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/react/src/components/notebook/Notebook2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ export interface INotebook2Props {
* Jupyter service manager.
*/
serviceManager: ServiceManager.IManager;
/**
* Service manager version - increment to force kernel recreation.
* Used when switching between service managers of the same type.
*/
serviceManagerVersion?: number;
/**
* Whether to start a default kernel or not.
*/
Expand Down Expand Up @@ -158,6 +163,7 @@ export function Notebook2(
requestedKernelId: props.kernelId,
kernels: serviceManager.kernels,
startDefaultKernel,
serviceManagerVersion: props.serviceManagerVersion,
});

const model = useNotebookModel({
Expand Down
12 changes: 12 additions & 0 deletions packages/react/src/components/notebook/Notebook2Adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,18 @@ export class Notebook2Adapter {
NotebookActions.redo(notebook);
}

/**
* Clear all outputs from all cells in the notebook.
*
* @remarks
* This will remove all execution outputs from all cells in the notebook,
* including output displays, execution counts, and error messages.
* The notebook must be available and properly initialized for this operation to succeed.
*/
clearAllOutputs(): void {
NotebookActions.clearAllOutputs(this._notebook);
}

/**
* Dispose of the adapter.
*/
Expand Down
Loading
Loading