Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Do nothing for sibling widgets for now.
}
};
let docRegistry = new DocumentRegistry();
let docManager = new DocumentManager({
registry: docRegistry,
manager,
opener
});
let mFactory = new NotebookModelFactory({});
let editorFactory = editorServices.factoryService.newInlineEditor.bind(
editorServices.factoryService);
let contentFactory = new NotebookPanel.ContentFactory({ editorFactory });
let wFactory = new NotebookWidgetFactory({
name: 'Notebook',
modelName: 'notebook',
fileExtensions: ['.ipynb'],
defaultFor: ['.ipynb'],
preferKernel: true,
canStartKernel: true,
rendermime, contentFactory,
mimeTypeService: editorServices.mimeTypeService
});
docRegistry.addModelFactory(mFactory);
docRegistry.addWidgetFactory(wFactory);
let nbWidget = docManager.open(NOTEBOOK) as NotebookPanel;
let palette = new CommandPalette({ commands });
const editor = nbWidget.notebook.activeCell && nbWidget.notebook.activeCell.editor;
function activateNotebookHandler(app: JupyterLab, mainMenu: IMainMenu, palette: ICommandPalette, contentFactory: NotebookPanel.IContentFactory, editorServices: IEditorServices, restorer: ILayoutRestorer, rendermime: IRenderMimeRegistry, settingRegistry: ISettingRegistry, browserFactory: IFileBrowserFactory | null, launcher: ILauncher | null): INotebookTracker {
const services = app.serviceManager;
// An object for tracking the current notebook settings.
let editorConfig = StaticNotebook.defaultEditorConfig;
const factory = new NotebookWidgetFactory({
name: FACTORY,
fileTypes: ['notebook'],
modelName: 'notebook',
defaultFor: ['notebook'],
preferKernel: true,
canStartKernel: true,
rendermime: rendermime,
contentFactory,
editorConfig,
mimeTypeService: editorServices.mimeTypeService
});
const { commands, restored } = app;
const tracker = new NotebookTracker({ namespace: 'notebook' });
// Handle state restoration.
restorer.restore(tracker, {
open: (widget: Widget) => {
// Do nothing for sibling widgets for now.
}
};
let docRegistry = new DocumentRegistry();
let docManager = new DocumentManager({
registry: docRegistry,
manager,
opener
});
let mFactory = new NotebookModelFactory({});
let editorFactory = editorServices.factoryService.newInlineEditor;
let contentFactory = new NotebookPanel.ContentFactory({ editorFactory });
let wFactory = new NotebookWidgetFactory({
name: 'Notebook',
modelName: 'notebook',
fileTypes: ['notebook'],
defaultFor: ['notebook'],
preferKernel: true,
canStartKernel: true,
rendermime,
contentFactory,
mimeTypeService: editorServices.mimeTypeService
});
docRegistry.addModelFactory(mFactory);
docRegistry.addWidgetFactory(wFactory);
let notebookPath = PageConfig.getOption('notebookPath');
let nbWidget = docManager.open(notebookPath) as NotebookPanel;
let palette = new CommandPalette({ commands });
open: (widget: Widget) => {
// Do nothing for sibling widgets for now.
}
};
let docRegistry = new DocumentRegistry();
let docManager = new DocumentManager({
registry: docRegistry,
manager: this.props.serviceManager,
opener
});
let mFactory = new NotebookModelFactory({});
let editorFactory = editorServices.factoryService.newInlineEditor;
let contentFactory = new NotebookPanel.ContentFactory({ editorFactory });
let wFactory = new NotebookWidgetFactory({
name: 'Notebook',
modelName: 'notebook',
fileTypes: ['notebook'],
defaultFor: ['notebook'],
preferKernel: true,
canStartKernel: true,
rendermime: this.props.rendermime,
contentFactory,
mimeTypeService: editorServices.mimeTypeService
});
docRegistry.addModelFactory(mFactory);
docRegistry.addWidgetFactory(wFactory);
this.nbWidget = docManager.open(this.props.notebookPath) as NotebookPanel;
this.addCommands();
function activateNotebookHandler(app: JupyterLab, mainMenu: IMainMenu, palette: ICommandPalette, contentFactory: NotebookPanel.IContentFactory, editorServices: IEditorServices, restorer: ILayoutRestorer, browserFactory: IFileBrowserFactory | null, launcher: ILauncher | null): INotebookTracker {
const services = app.serviceManager;
const factory = new NotebookWidgetFactory({
name: FACTORY,
fileTypes: ['notebook'],
modelName: 'notebook',
defaultFor: ['notebook'],
preferKernel: true,
canStartKernel: true,
rendermime: app.rendermime,
contentFactory,
mimeTypeService: editorServices.mimeTypeService
});
const { commands } = app;
const tracker = new NotebookTracker({ namespace: 'notebook' });
// Handle state restoration.
restorer.restore(tracker, {
command: 'docmanager:open',
open: (widget: Widget) => {
// Do nothing for sibling widgets for now.
}
};
let docRegistry = new DocumentRegistry();
let docManager = new DocumentManager({
registry: docRegistry,
manager,
opener
});
let mFactory = new NotebookModelFactory({});
let editorFactory = editorServices.factoryService.newInlineEditor;
let contentFactory = new NotebookPanel.ContentFactory({ editorFactory });
let wFactory = new NotebookWidgetFactory({
name: 'Notebook',
modelName: 'notebook',
fileTypes: ['notebook'],
defaultFor: ['notebook'],
preferKernel: true,
canStartKernel: true,
rendermime,
contentFactory,
mimeTypeService: editorServices.mimeTypeService
});
docRegistry.addModelFactory(mFactory);
docRegistry.addWidgetFactory(wFactory);
let notebookPath = PageConfig.getOption('notebookPath');
let nbWidget = docManager.open(notebookPath) as NotebookPanel;
let palette = new CommandPalette({ commands });
open: (widget: Widget) => {
// Do nothing for sibling widgets for now.
}
};
let docRegistry = new DocumentRegistry();
let docManager = new DocumentManager({
registry: docRegistry,
manager,
opener
});
let mFactory = new NotebookModelFactory({});
let editorFactory = editorServices.factoryService.newInlineEditor;
let contentFactory = new NotebookPanel.ContentFactory({ editorFactory });
let wFactory = new NotebookWidgetFactory({
name: 'Notebook',
modelName: 'notebook',
fileTypes: ['notebook'],
defaultFor: ['notebook'],
preferKernel: true,
canStartKernel: true,
rendermime,
contentFactory,
mimeTypeService: editorServices.mimeTypeService
});
docRegistry.addModelFactory(mFactory);
docRegistry.addWidgetFactory(wFactory);
let notebookPath = PageConfig.getOption('notebookPath');
let nbWidget = docManager.open(notebookPath) as NotebookPanel;
function createFactory(
toolbarFactory?: (widget: NotebookPanel) => DocumentRegistry.IToolbarItem[]
): NotebookWidgetFactory {
return new NotebookWidgetFactory({
name: 'notebook',
fileTypes: ['notebook'],
rendermime,
toolbarFactory,
contentFactory,
mimeTypeService: NBTestUtils.mimeTypeService,
editorConfig: NBTestUtils.defaultEditorConfig
});
}