import { NotebookPanel } from '@jupyterlab/notebook'; import { DocumentRegistry } from '@jupyterlab/docregistry'; // Create a new notebook panel const context = new DocumentRegistry.Context({ path: 'Untitled.ipynb', type: 'notebook', content: { cells: [], metadata: {}, nbformat: 4, nbformat_minor: 4, }, }); const panel = new NotebookPanel({ context });
import { DocumentRegistry } from '@jupyterlab/docregistry'; function saveFile(context: DocumentRegistry.Context): PromiseOverall, the @jupyterlab.docregistry Context is an important interface used throughout JupyterLab to represent various file types and their metadata. The examples demonstrate how it can be used to create and manipulate files.{ return context.save().then(() => { console.log(`File ${context.path} saved successfully!`); }).catch(() => { console.error(`Error saving file ${context.path}`); }); }