-
-
Notifications
You must be signed in to change notification settings - Fork 41
/
JupyterReactContentFactory.ts
59 lines (54 loc) 路 1.62 KB
/
JupyterReactContentFactory.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* Copyright (c) 2022-2023 Datalayer Inc. All rights reserved.
*
* MIT License
*/
import { Store } from 'redux';
import { CommandRegistry } from '@lumino/commands';
import { NotebookPanel } from '@jupyterlab/notebook';
import { ICellHeader, Cell } from '@jupyterlab/cells';
import { CellSidebarWidget, CellSidebarProps } from '../cell/sidebar/CellSidebarWidget';
// import { IInputPrompt } from '@jupyterlab/cells';
// import { NotebookInputPrompt } from './../cell/InputPrompt';
/**
* Extend the default implementation NotebookPanel.ContentFactory of `IContentFactory`.
*/
export class JupyterReactContentFactory extends NotebookPanel.ContentFactory {
private readonly CellSidebar: (props: CellSidebarProps) => JSX.Element;
private readonly notebookId: string;
private readonly nbgrader: boolean;
private readonly commands: CommandRegistry;
private readonly store: Store;
constructor(
CellSidebar: (props: CellSidebarProps) => JSX.Element,
notebookId: string,
nbgrader: boolean,
commands: CommandRegistry,
options: Cell.ContentFactory.IOptions,
store?: Store,
) {
super(options);
this.CellSidebar = CellSidebar;
super.createCodeCell
this.notebookId = notebookId,
this.nbgrader = nbgrader;
this.commands = commands;
this.store = store!;
}
/** @override */
createCellHeader(): ICellHeader {
return new CellSidebarWidget(
this.CellSidebar,
this.notebookId,
this.nbgrader,
this.commands,
this.store,
);
}
/*
createInputPrompt(): IInputPrompt {
return new InputPrompt();
}
*/
}
export default JupyterReactContentFactory;