1 |
|
2 |
|
3 | import { NotebookModel } from './model';
|
4 |
|
5 |
|
6 |
|
7 | export class NotebookModelFactory {
|
8 | |
9 |
|
10 |
|
11 | constructor(options) {
|
12 | this._disposed = false;
|
13 | this._disableDocumentWideUndoRedo =
|
14 | options.disableDocumentWideUndoRedo || false;
|
15 | const codeCellContentFactory = options.codeCellContentFactory;
|
16 | this.contentFactory =
|
17 | options.contentFactory ||
|
18 | new NotebookModel.ContentFactory({ codeCellContentFactory });
|
19 | }
|
20 | |
21 |
|
22 |
|
23 | set disableDocumentWideUndoRedo(disableDocumentWideUndoRedo) {
|
24 | this._disableDocumentWideUndoRedo = disableDocumentWideUndoRedo;
|
25 | }
|
26 | |
27 |
|
28 |
|
29 | get name() {
|
30 | return 'notebook';
|
31 | }
|
32 | |
33 |
|
34 |
|
35 | get contentType() {
|
36 | return 'notebook';
|
37 | }
|
38 | |
39 |
|
40 |
|
41 | get fileFormat() {
|
42 | return 'json';
|
43 | }
|
44 | |
45 |
|
46 |
|
47 | get isDisposed() {
|
48 | return this._disposed;
|
49 | }
|
50 | |
51 |
|
52 |
|
53 | dispose() {
|
54 | this._disposed = true;
|
55 | }
|
56 | |
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 | createNew(languagePreference, modelDB, isInitialized) {
|
64 | const contentFactory = this.contentFactory;
|
65 | return new NotebookModel({
|
66 | languagePreference,
|
67 | contentFactory,
|
68 | modelDB,
|
69 | isInitialized,
|
70 | disableDocumentWideUndoRedo: this._disableDocumentWideUndoRedo
|
71 | });
|
72 | }
|
73 | |
74 |
|
75 |
|
76 | preferredLanguage(path) {
|
77 | return '';
|
78 | }
|
79 | }
|
80 |
|
\ | No newline at end of file |