@jupyterlab/notebook 4.0.0-alpha.13 → 4.0.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/actions.d.ts +3 -3
- package/lib/actions.js +207 -255
- package/lib/actions.js.map +1 -1
- package/lib/celllist.d.ts +4 -223
- package/lib/celllist.js +40 -373
- package/lib/celllist.js.map +1 -1
- package/lib/constants.d.ts +8 -0
- package/lib/constants.js +13 -0
- package/lib/constants.js.map +1 -0
- package/lib/executionindicator.js +2 -2
- package/lib/executionindicator.js.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.js +3 -2
- package/lib/index.js.map +1 -1
- package/lib/model.d.ts +11 -187
- package/lib/model.js +28 -180
- package/lib/model.js.map +1 -1
- package/lib/modelfactory.d.ts +2 -17
- package/lib/modelfactory.js +1 -9
- package/lib/modelfactory.js.map +1 -1
- package/lib/notebooklspadapter.d.ts +19 -15
- package/lib/notebooklspadapter.js +56 -46
- package/lib/notebooklspadapter.js.map +1 -1
- package/lib/notebooktools.d.ts +5 -14
- package/lib/notebooktools.js +42 -54
- package/lib/notebooktools.js.map +1 -1
- package/lib/panel.d.ts +0 -4
- package/lib/panel.js +9 -17
- package/lib/panel.js.map +1 -1
- package/lib/searchprovider.d.ts +1 -1
- package/lib/searchprovider.js +54 -29
- package/lib/searchprovider.js.map +1 -1
- package/lib/toc.d.ts +12 -20
- package/lib/toc.js +118 -104
- package/lib/toc.js.map +1 -1
- package/lib/widget.d.ts +102 -90
- package/lib/widget.js +422 -386
- package/lib/widget.js.map +1 -1
- package/lib/windowing.d.ts +112 -0
- package/lib/windowing.js +244 -0
- package/lib/windowing.js.map +1 -0
- package/package.json +30 -29
- package/style/base.css +15 -10
package/lib/model.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { CellModel, CodeCellModel, ICellModel, ICodeCellModel, IMarkdownCellModel, IRawCellModel } from '@jupyterlab/cells';
|
|
2
1
|
import { IChangedArgs } from '@jupyterlab/coreutils';
|
|
3
2
|
import { DocumentRegistry } from '@jupyterlab/docregistry';
|
|
4
3
|
import * as nbformat from '@jupyterlab/nbformat';
|
|
5
|
-
import {
|
|
6
|
-
import * as
|
|
4
|
+
import { IObservableJSON } from '@jupyterlab/observables';
|
|
5
|
+
import * as sharedModels from '@jupyterlab/shared-models';
|
|
7
6
|
import { ITranslator } from '@jupyterlab/translation';
|
|
8
7
|
import { ISignal } from '@lumino/signaling';
|
|
8
|
+
import { CellList } from './celllist';
|
|
9
9
|
/**
|
|
10
10
|
* The definition of a model object for a notebook widget.
|
|
11
11
|
*/
|
|
@@ -13,11 +13,7 @@ export interface INotebookModel extends DocumentRegistry.IModel {
|
|
|
13
13
|
/**
|
|
14
14
|
* The list of cells in the notebook.
|
|
15
15
|
*/
|
|
16
|
-
readonly cells:
|
|
17
|
-
/**
|
|
18
|
-
* The cell model factory for the notebook.
|
|
19
|
-
*/
|
|
20
|
-
readonly contentFactory: NotebookModel.IContentFactory;
|
|
16
|
+
readonly cells: CellList;
|
|
21
17
|
/**
|
|
22
18
|
* The major version number of the nbformat.
|
|
23
19
|
*/
|
|
@@ -35,10 +31,9 @@ export interface INotebookModel extends DocumentRegistry.IModel {
|
|
|
35
31
|
*/
|
|
36
32
|
readonly deletedCells: string[];
|
|
37
33
|
/**
|
|
38
|
-
*
|
|
34
|
+
* Shared model
|
|
39
35
|
*/
|
|
40
|
-
|
|
41
|
-
readonly sharedModel: models.ISharedNotebook;
|
|
36
|
+
readonly sharedModel: sharedModels.ISharedNotebook;
|
|
42
37
|
}
|
|
43
38
|
/**
|
|
44
39
|
* An implementation of a notebook Model.
|
|
@@ -73,7 +68,7 @@ export declare class NotebookModel implements INotebookModel {
|
|
|
73
68
|
/**
|
|
74
69
|
* Get the observable list of notebook cells.
|
|
75
70
|
*/
|
|
76
|
-
get cells():
|
|
71
|
+
get cells(): CellList;
|
|
77
72
|
/**
|
|
78
73
|
* The major version number of the nbformat.
|
|
79
74
|
*/
|
|
@@ -90,10 +85,6 @@ export declare class NotebookModel implements INotebookModel {
|
|
|
90
85
|
* A list of deleted cells for the notebook..
|
|
91
86
|
*/
|
|
92
87
|
get deletedCells(): string[];
|
|
93
|
-
/**
|
|
94
|
-
* If the model is initialized or not.
|
|
95
|
-
*/
|
|
96
|
-
get isInitialized(): boolean;
|
|
97
88
|
/**
|
|
98
89
|
* The default kernel language of the document.
|
|
99
90
|
*/
|
|
@@ -124,14 +115,6 @@ export declare class NotebookModel implements INotebookModel {
|
|
|
124
115
|
* Should emit a [contentChanged] signal.
|
|
125
116
|
*/
|
|
126
117
|
fromJSON(value: nbformat.INotebookContent): void;
|
|
127
|
-
/**
|
|
128
|
-
* Initialize the model with its current state.
|
|
129
|
-
*
|
|
130
|
-
* # Notes
|
|
131
|
-
* Adds an empty code cell if the model is empty
|
|
132
|
-
* and clears undo state.
|
|
133
|
-
*/
|
|
134
|
-
initialize(): void;
|
|
135
118
|
/**
|
|
136
119
|
* Handle a change in the cells list.
|
|
137
120
|
*/
|
|
@@ -154,33 +137,24 @@ export declare class NotebookModel implements INotebookModel {
|
|
|
154
137
|
* Whether the model is disposed.
|
|
155
138
|
*/
|
|
156
139
|
get isDisposed(): boolean;
|
|
157
|
-
/**
|
|
158
|
-
* The cell model factory for the notebook.
|
|
159
|
-
*/
|
|
160
|
-
readonly contentFactory: NotebookModel.IContentFactory;
|
|
161
140
|
/**
|
|
162
141
|
* The shared notebook model.
|
|
163
142
|
*/
|
|
164
|
-
readonly sharedModel:
|
|
143
|
+
readonly sharedModel: sharedModels.ISharedNotebook;
|
|
165
144
|
/**
|
|
166
145
|
* A mutex to update the shared model.
|
|
167
146
|
*/
|
|
168
147
|
protected readonly _modelDBMutex: (f: () => void) => void;
|
|
169
|
-
/**
|
|
170
|
-
* The underlying `IModelDB` instance in which model
|
|
171
|
-
* data is stored.
|
|
172
|
-
*/
|
|
173
|
-
readonly modelDB: IModelDB;
|
|
174
148
|
private _dirty;
|
|
175
149
|
private _readOnly;
|
|
176
150
|
private _contentChanged;
|
|
177
151
|
private _stateChanged;
|
|
178
152
|
private _trans;
|
|
179
153
|
private _cells;
|
|
154
|
+
private _metadata;
|
|
180
155
|
private _nbformat;
|
|
181
156
|
private _nbformatMinor;
|
|
182
157
|
private _deletedCells;
|
|
183
|
-
private _isInitialized;
|
|
184
158
|
private _isDisposed;
|
|
185
159
|
}
|
|
186
160
|
/**
|
|
@@ -196,166 +170,16 @@ export declare namespace NotebookModel {
|
|
|
196
170
|
*/
|
|
197
171
|
languagePreference?: string;
|
|
198
172
|
/**
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
* The default is a shared factory instance.
|
|
173
|
+
* Default cell type.
|
|
202
174
|
*/
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* A modelDB for storing notebook data.
|
|
206
|
-
*/
|
|
207
|
-
modelDB?: IModelDB;
|
|
175
|
+
defaultCell?: 'code' | 'markdown' | 'raw';
|
|
208
176
|
/**
|
|
209
177
|
* Language translator.
|
|
210
178
|
*/
|
|
211
179
|
translator?: ITranslator;
|
|
212
|
-
/**
|
|
213
|
-
* If the model is initialized or not.
|
|
214
|
-
*/
|
|
215
|
-
isInitialized?: boolean;
|
|
216
180
|
/**
|
|
217
181
|
* Defines if the document can be undo/redo.
|
|
218
182
|
*/
|
|
219
183
|
disableDocumentWideUndoRedo?: boolean;
|
|
220
184
|
}
|
|
221
|
-
/**
|
|
222
|
-
* A factory for creating notebook model content.
|
|
223
|
-
*/
|
|
224
|
-
interface IContentFactory {
|
|
225
|
-
/**
|
|
226
|
-
* The factory for output area models.
|
|
227
|
-
*/
|
|
228
|
-
readonly codeCellContentFactory: CodeCellModel.IContentFactory;
|
|
229
|
-
/**
|
|
230
|
-
* The IModelDB in which to put data for the notebook model.
|
|
231
|
-
*/
|
|
232
|
-
modelDB: IModelDB | undefined;
|
|
233
|
-
/**
|
|
234
|
-
* Create a new cell by cell type.
|
|
235
|
-
*
|
|
236
|
-
* @param type: the type of the cell to create.
|
|
237
|
-
*
|
|
238
|
-
* @param options: the cell creation options.
|
|
239
|
-
*
|
|
240
|
-
* #### Notes
|
|
241
|
-
* This method is intended to be a convenience method to programmatically
|
|
242
|
-
* call the other cell creation methods in the factory.
|
|
243
|
-
*/
|
|
244
|
-
createCell(type: nbformat.CellType, options: CellModel.IOptions): ICellModel;
|
|
245
|
-
/**
|
|
246
|
-
* Create a new code cell.
|
|
247
|
-
*
|
|
248
|
-
* @param options - The options used to create the cell.
|
|
249
|
-
*
|
|
250
|
-
* @returns A new code cell. If a source cell is provided, the
|
|
251
|
-
* new cell will be initialized with the data from the source.
|
|
252
|
-
*/
|
|
253
|
-
createCodeCell(options: CodeCellModel.IOptions): ICodeCellModel;
|
|
254
|
-
/**
|
|
255
|
-
* Create a new markdown cell.
|
|
256
|
-
*
|
|
257
|
-
* @param options - The options used to create the cell.
|
|
258
|
-
*
|
|
259
|
-
* @returns A new markdown cell. If a source cell is provided, the
|
|
260
|
-
* new cell will be initialized with the data from the source.
|
|
261
|
-
*/
|
|
262
|
-
createMarkdownCell(options: CellModel.IOptions): IMarkdownCellModel;
|
|
263
|
-
/**
|
|
264
|
-
* Create a new raw cell.
|
|
265
|
-
*
|
|
266
|
-
* @param options - The options used to create the cell.
|
|
267
|
-
*
|
|
268
|
-
* @returns A new raw cell. If a source cell is provided, the
|
|
269
|
-
* new cell will be initialized with the data from the source.
|
|
270
|
-
*/
|
|
271
|
-
createRawCell(options: CellModel.IOptions): IRawCellModel;
|
|
272
|
-
/**
|
|
273
|
-
* Clone the content factory with a new IModelDB.
|
|
274
|
-
*/
|
|
275
|
-
clone(modelDB: IModelDB): IContentFactory;
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* The default implementation of an `IContentFactory`.
|
|
279
|
-
*/
|
|
280
|
-
class ContentFactory {
|
|
281
|
-
/**
|
|
282
|
-
* Create a new cell model factory.
|
|
283
|
-
*/
|
|
284
|
-
constructor(options: ContentFactory.IOptions);
|
|
285
|
-
/**
|
|
286
|
-
* The factory for code cell content.
|
|
287
|
-
*/
|
|
288
|
-
readonly codeCellContentFactory: CodeCellModel.IContentFactory;
|
|
289
|
-
/**
|
|
290
|
-
* The IModelDB in which to put the notebook data.
|
|
291
|
-
*/
|
|
292
|
-
readonly modelDB: IModelDB | undefined;
|
|
293
|
-
/**
|
|
294
|
-
* Create a new cell by cell type.
|
|
295
|
-
*
|
|
296
|
-
* @param type: the type of the cell to create.
|
|
297
|
-
*
|
|
298
|
-
* @param options: the cell creation options.
|
|
299
|
-
*
|
|
300
|
-
* #### Notes
|
|
301
|
-
* This method is intended to be a convenience method to programmatically
|
|
302
|
-
* call the other cell creation methods in the factory.
|
|
303
|
-
*/
|
|
304
|
-
createCell(type: nbformat.CellType, options: CellModel.IOptions): ICellModel;
|
|
305
|
-
/**
|
|
306
|
-
* Create a new code cell.
|
|
307
|
-
*
|
|
308
|
-
* @param source - The data to use for the original source data.
|
|
309
|
-
*
|
|
310
|
-
* @returns A new code cell. If a source cell is provided, the
|
|
311
|
-
* new cell will be initialized with the data from the source.
|
|
312
|
-
* If the contentFactory is not provided, the instance
|
|
313
|
-
* `codeCellContentFactory` will be used.
|
|
314
|
-
*/
|
|
315
|
-
createCodeCell(options: CodeCellModel.IOptions): ICodeCellModel;
|
|
316
|
-
/**
|
|
317
|
-
* Create a new markdown cell.
|
|
318
|
-
*
|
|
319
|
-
* @param source - The data to use for the original source data.
|
|
320
|
-
*
|
|
321
|
-
* @returns A new markdown cell. If a source cell is provided, the
|
|
322
|
-
* new cell will be initialized with the data from the source.
|
|
323
|
-
*/
|
|
324
|
-
createMarkdownCell(options: CellModel.IOptions): IMarkdownCellModel;
|
|
325
|
-
/**
|
|
326
|
-
* Create a new raw cell.
|
|
327
|
-
*
|
|
328
|
-
* @param source - The data to use for the original source data.
|
|
329
|
-
*
|
|
330
|
-
* @returns A new raw cell. If a source cell is provided, the
|
|
331
|
-
* new cell will be initialized with the data from the source.
|
|
332
|
-
*/
|
|
333
|
-
createRawCell(options: CellModel.IOptions): IRawCellModel;
|
|
334
|
-
/**
|
|
335
|
-
* Clone the content factory with a new IModelDB.
|
|
336
|
-
*/
|
|
337
|
-
clone(modelDB: IModelDB): ContentFactory;
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* A namespace for the notebook model content factory.
|
|
341
|
-
*/
|
|
342
|
-
namespace ContentFactory {
|
|
343
|
-
/**
|
|
344
|
-
* The options used to initialize a `ContentFactory`.
|
|
345
|
-
*/
|
|
346
|
-
interface IOptions {
|
|
347
|
-
/**
|
|
348
|
-
* The factory for code cell model content.
|
|
349
|
-
*/
|
|
350
|
-
codeCellContentFactory?: CodeCellModel.IContentFactory;
|
|
351
|
-
/**
|
|
352
|
-
* The modelDB in which to place new content.
|
|
353
|
-
*/
|
|
354
|
-
modelDB?: IModelDB;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* The default `ContentFactory` instance.
|
|
359
|
-
*/
|
|
360
|
-
const defaultContentFactory: ContentFactory;
|
|
361
185
|
}
|
package/lib/model.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
3
|
import { Dialog, showDialog } from '@jupyterlab/apputils';
|
|
4
|
-
import { CodeCellModel, MarkdownCellModel, RawCellModel } from '@jupyterlab/cells';
|
|
5
4
|
import * as nbformat from '@jupyterlab/nbformat';
|
|
6
|
-
import {
|
|
7
|
-
import * as
|
|
5
|
+
import { ObservableJSON } from '@jupyterlab/observables';
|
|
6
|
+
import * as sharedModels from '@jupyterlab/shared-models';
|
|
8
7
|
import { nullTranslator } from '@jupyterlab/translation';
|
|
9
|
-
import { UUID } from '@lumino/coreutils';
|
|
10
8
|
import { Signal } from '@lumino/signaling';
|
|
11
9
|
import { CellList } from './celllist';
|
|
12
10
|
/**
|
|
@@ -17,10 +15,11 @@ export class NotebookModel {
|
|
|
17
15
|
* Construct a new notebook model.
|
|
18
16
|
*/
|
|
19
17
|
constructor(options = {}) {
|
|
18
|
+
var _a;
|
|
20
19
|
/**
|
|
21
20
|
* A mutex to update the shared model.
|
|
22
21
|
*/
|
|
23
|
-
this._modelDBMutex =
|
|
22
|
+
this._modelDBMutex = sharedModels.createMutex();
|
|
24
23
|
this._dirty = false;
|
|
25
24
|
this._readOnly = false;
|
|
26
25
|
this._contentChanged = new Signal(this);
|
|
@@ -28,27 +27,21 @@ export class NotebookModel {
|
|
|
28
27
|
this._nbformat = nbformat.MAJOR_VERSION;
|
|
29
28
|
this._nbformatMinor = nbformat.MINOR_VERSION;
|
|
30
29
|
this._isDisposed = false;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
this.sharedModel = models.YNotebook.create(options.disableDocumentWideUndoRedo || false);
|
|
38
|
-
this._isInitialized = options.isInitialized === false ? false : true;
|
|
39
|
-
const factory = options.contentFactory || NotebookModel.defaultContentFactory;
|
|
40
|
-
this.contentFactory = factory.clone(this.modelDB.view('cells'));
|
|
41
|
-
this._cells = new CellList(this.modelDB, this.contentFactory, this.sharedModel);
|
|
30
|
+
this.sharedModel = sharedModels.YNotebook.create({
|
|
31
|
+
disableDocumentWideUndoRedo: (_a = options.disableDocumentWideUndoRedo) !== null && _a !== void 0 ? _a : false,
|
|
32
|
+
initialCellType: options.defaultCell
|
|
33
|
+
});
|
|
34
|
+
this._cells = new CellList(this.sharedModel);
|
|
42
35
|
this._trans = (options.translator || nullTranslator).load('jupyterlab');
|
|
43
36
|
this._cells.changed.connect(this._onCellsChanged, this);
|
|
44
37
|
// Handle initial metadata.
|
|
45
|
-
|
|
46
|
-
if (!
|
|
38
|
+
this._metadata = new ObservableJSON();
|
|
39
|
+
if (!this._metadata.has('language_info')) {
|
|
47
40
|
const name = options.languagePreference || '';
|
|
48
|
-
|
|
41
|
+
this._metadata.set('language_info', { name });
|
|
49
42
|
}
|
|
50
43
|
this._ensureMetadata();
|
|
51
|
-
|
|
44
|
+
this._metadata.changed.connect(this._onMetadataChanged, this);
|
|
52
45
|
this._deletedCells = [];
|
|
53
46
|
this.sharedModel.changed.connect(this._onStateChanged, this);
|
|
54
47
|
}
|
|
@@ -100,7 +93,7 @@ export class NotebookModel {
|
|
|
100
93
|
* The metadata associated with the notebook.
|
|
101
94
|
*/
|
|
102
95
|
get metadata() {
|
|
103
|
-
return this.
|
|
96
|
+
return this._metadata;
|
|
104
97
|
}
|
|
105
98
|
/**
|
|
106
99
|
* Get the observable list of notebook cells.
|
|
@@ -133,12 +126,6 @@ export class NotebookModel {
|
|
|
133
126
|
get deletedCells() {
|
|
134
127
|
return this._deletedCells;
|
|
135
128
|
}
|
|
136
|
-
/**
|
|
137
|
-
* If the model is initialized or not.
|
|
138
|
-
*/
|
|
139
|
-
get isInitialized() {
|
|
140
|
-
return this._isInitialized;
|
|
141
|
-
}
|
|
142
129
|
/**
|
|
143
130
|
* The default kernel language of the document.
|
|
144
131
|
*/
|
|
@@ -157,8 +144,8 @@ export class NotebookModel {
|
|
|
157
144
|
const cells = this.cells;
|
|
158
145
|
this._cells = null;
|
|
159
146
|
cells.dispose();
|
|
147
|
+
this.sharedModel.dispose();
|
|
160
148
|
this._isDisposed = true;
|
|
161
|
-
this.modelDB.dispose();
|
|
162
149
|
Signal.clearData(this);
|
|
163
150
|
}
|
|
164
151
|
/**
|
|
@@ -209,35 +196,21 @@ export class NotebookModel {
|
|
|
209
196
|
* Should emit a [contentChanged] signal.
|
|
210
197
|
*/
|
|
211
198
|
fromJSON(value) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
break;
|
|
224
|
-
case 'markdown':
|
|
225
|
-
cells.push(factory.createMarkdownCell(options));
|
|
226
|
-
break;
|
|
227
|
-
case 'raw':
|
|
228
|
-
cells.push(factory.createRawCell(options));
|
|
229
|
-
break;
|
|
230
|
-
default:
|
|
231
|
-
continue;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
this.cells.beginCompoundOperation();
|
|
235
|
-
this.cells.clear();
|
|
236
|
-
this.cells.pushAll(cells);
|
|
237
|
-
this.cells.endCompoundOperation();
|
|
199
|
+
this.sharedModel.transact(() => {
|
|
200
|
+
const useId = value.nbformat === 4 && value.nbformat_minor >= 5;
|
|
201
|
+
const ycells = value.cells.map(cell => {
|
|
202
|
+
if (!useId) {
|
|
203
|
+
delete cell.id;
|
|
204
|
+
}
|
|
205
|
+
return sharedModels.createCell(cell);
|
|
206
|
+
});
|
|
207
|
+
this.sharedModel.insertCells(this.sharedModel.cells.length, ycells);
|
|
208
|
+
this.sharedModel.deleteCellRange(0, this.sharedModel.cells.length);
|
|
209
|
+
});
|
|
238
210
|
this.sharedModel.nbformat_minor =
|
|
239
211
|
nbformat.MINOR_VERSION;
|
|
240
|
-
this.sharedModel.nbformat =
|
|
212
|
+
this.sharedModel.nbformat =
|
|
213
|
+
nbformat.MAJOR_VERSION;
|
|
241
214
|
const origNbformat = value.metadata.orig_nbformat;
|
|
242
215
|
if (value.nbformat !== this._nbformat) {
|
|
243
216
|
this.sharedModel.nbformat = value.nbformat;
|
|
@@ -283,21 +256,6 @@ close the notebook without saving it.`, origNbformat, this._nbformat);
|
|
|
283
256
|
this._ensureMetadata();
|
|
284
257
|
this.dirty = true;
|
|
285
258
|
}
|
|
286
|
-
/**
|
|
287
|
-
* Initialize the model with its current state.
|
|
288
|
-
*
|
|
289
|
-
* # Notes
|
|
290
|
-
* Adds an empty code cell if the model is empty
|
|
291
|
-
* and clears undo state.
|
|
292
|
-
*/
|
|
293
|
-
initialize() {
|
|
294
|
-
if (!this.cells.length) {
|
|
295
|
-
const factory = this.contentFactory;
|
|
296
|
-
this.cells.push(factory.createCodeCell({}));
|
|
297
|
-
}
|
|
298
|
-
this._isInitialized = true;
|
|
299
|
-
this.cells.clearUndo();
|
|
300
|
-
}
|
|
301
259
|
/**
|
|
302
260
|
* Handle a change in the cells list.
|
|
303
261
|
*/
|
|
@@ -385,114 +343,4 @@ close the notebook without saving it.`, origNbformat, this._nbformat);
|
|
|
385
343
|
return this._isDisposed;
|
|
386
344
|
}
|
|
387
345
|
}
|
|
388
|
-
/**
|
|
389
|
-
* The namespace for the `NotebookModel` class statics.
|
|
390
|
-
*/
|
|
391
|
-
(function (NotebookModel) {
|
|
392
|
-
/**
|
|
393
|
-
* The default implementation of an `IContentFactory`.
|
|
394
|
-
*/
|
|
395
|
-
class ContentFactory {
|
|
396
|
-
/**
|
|
397
|
-
* Create a new cell model factory.
|
|
398
|
-
*/
|
|
399
|
-
constructor(options) {
|
|
400
|
-
this.codeCellContentFactory =
|
|
401
|
-
options.codeCellContentFactory || CodeCellModel.defaultContentFactory;
|
|
402
|
-
this.modelDB = options.modelDB;
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* Create a new cell by cell type.
|
|
406
|
-
*
|
|
407
|
-
* @param type: the type of the cell to create.
|
|
408
|
-
*
|
|
409
|
-
* @param options: the cell creation options.
|
|
410
|
-
*
|
|
411
|
-
* #### Notes
|
|
412
|
-
* This method is intended to be a convenience method to programmatically
|
|
413
|
-
* call the other cell creation methods in the factory.
|
|
414
|
-
*/
|
|
415
|
-
createCell(type, options) {
|
|
416
|
-
switch (type) {
|
|
417
|
-
case 'code':
|
|
418
|
-
return this.createCodeCell(options);
|
|
419
|
-
case 'markdown':
|
|
420
|
-
return this.createMarkdownCell(options);
|
|
421
|
-
case 'raw':
|
|
422
|
-
default:
|
|
423
|
-
return this.createRawCell(options);
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Create a new code cell.
|
|
428
|
-
*
|
|
429
|
-
* @param source - The data to use for the original source data.
|
|
430
|
-
*
|
|
431
|
-
* @returns A new code cell. If a source cell is provided, the
|
|
432
|
-
* new cell will be initialized with the data from the source.
|
|
433
|
-
* If the contentFactory is not provided, the instance
|
|
434
|
-
* `codeCellContentFactory` will be used.
|
|
435
|
-
*/
|
|
436
|
-
createCodeCell(options) {
|
|
437
|
-
if (options.contentFactory) {
|
|
438
|
-
options.contentFactory = this.codeCellContentFactory;
|
|
439
|
-
}
|
|
440
|
-
if (this.modelDB) {
|
|
441
|
-
if (!options.id) {
|
|
442
|
-
options.id = UUID.uuid4();
|
|
443
|
-
}
|
|
444
|
-
options.modelDB = this.modelDB.view(options.id);
|
|
445
|
-
}
|
|
446
|
-
return new CodeCellModel(options);
|
|
447
|
-
}
|
|
448
|
-
/**
|
|
449
|
-
* Create a new markdown cell.
|
|
450
|
-
*
|
|
451
|
-
* @param source - The data to use for the original source data.
|
|
452
|
-
*
|
|
453
|
-
* @returns A new markdown cell. If a source cell is provided, the
|
|
454
|
-
* new cell will be initialized with the data from the source.
|
|
455
|
-
*/
|
|
456
|
-
createMarkdownCell(options) {
|
|
457
|
-
if (this.modelDB) {
|
|
458
|
-
if (!options.id) {
|
|
459
|
-
options.id = UUID.uuid4();
|
|
460
|
-
}
|
|
461
|
-
options.modelDB = this.modelDB.view(options.id);
|
|
462
|
-
}
|
|
463
|
-
return new MarkdownCellModel(options);
|
|
464
|
-
}
|
|
465
|
-
/**
|
|
466
|
-
* Create a new raw cell.
|
|
467
|
-
*
|
|
468
|
-
* @param source - The data to use for the original source data.
|
|
469
|
-
*
|
|
470
|
-
* @returns A new raw cell. If a source cell is provided, the
|
|
471
|
-
* new cell will be initialized with the data from the source.
|
|
472
|
-
*/
|
|
473
|
-
createRawCell(options) {
|
|
474
|
-
if (this.modelDB) {
|
|
475
|
-
if (!options.id) {
|
|
476
|
-
options.id = UUID.uuid4();
|
|
477
|
-
}
|
|
478
|
-
options.modelDB = this.modelDB.view(options.id);
|
|
479
|
-
}
|
|
480
|
-
return new RawCellModel(options);
|
|
481
|
-
}
|
|
482
|
-
/**
|
|
483
|
-
* Clone the content factory with a new IModelDB.
|
|
484
|
-
*/
|
|
485
|
-
clone(modelDB) {
|
|
486
|
-
return new ContentFactory({
|
|
487
|
-
modelDB: modelDB,
|
|
488
|
-
codeCellContentFactory: this.codeCellContentFactory
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
NotebookModel.ContentFactory = ContentFactory;
|
|
493
|
-
/**
|
|
494
|
-
* The default `ContentFactory` instance.
|
|
495
|
-
*/
|
|
496
|
-
NotebookModel.defaultContentFactory = new ContentFactory({});
|
|
497
|
-
})(NotebookModel || (NotebookModel = {}));
|
|
498
346
|
//# sourceMappingURL=model.js.map
|
package/lib/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAEL,aAAa,EAKb,iBAAiB,EACjB,YAAY,EACb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAML,OAAO,EACR,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAEL,cAAc,EAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAwC,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AA2CtC;;GAEG;AACH,MAAM,OAAO,aAAa;IACxB;;OAEG;IACH,YAAY,UAAkC,EAAE;QA0ahD;;WAEG;QACgB,kBAAa,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QAQhD,WAAM,GAAG,KAAK,CAAC;QACf,cAAS,GAAG,KAAK,CAAC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I,CAAC,aAAa,CAAC,GAAG,EAAE;YACtB,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IAED;;OAEG;IACK,eAAe;QACrB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE;YAClC,QAAQ,CAAC,GAAG,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;SAC7C;QACD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;YAC/B,QAAQ,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC;SAC5D;IACH,CAAC;IAED;;OAEG;IACO,kBAAkB,CAAC,IAAuB;QAClD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACO,oBAAoB;QAC5B,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CAwBF"}
|
package/lib/modelfactory.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { CodeCellModel } from '@jupyterlab/cells';
|
|
2
1
|
import { DocumentRegistry } from '@jupyterlab/docregistry';
|
|
3
|
-
import { IModelDB } from '@jupyterlab/observables';
|
|
4
2
|
import { Contents } from '@jupyterlab/services';
|
|
5
|
-
import { INotebookModel
|
|
3
|
+
import { INotebookModel } from './model';
|
|
6
4
|
/**
|
|
7
5
|
* A model factory for notebooks.
|
|
8
6
|
*/
|
|
@@ -11,10 +9,6 @@ export declare class NotebookModelFactory implements DocumentRegistry.IModelFact
|
|
|
11
9
|
* Construct a new notebook model factory.
|
|
12
10
|
*/
|
|
13
11
|
constructor(options: NotebookModelFactory.IOptions);
|
|
14
|
-
/**
|
|
15
|
-
* The content model factory used by the NotebookModelFactory.
|
|
16
|
-
*/
|
|
17
|
-
readonly contentFactory: NotebookModel.IContentFactory;
|
|
18
12
|
/**
|
|
19
13
|
* Define the disableDocumentWideUndoRedo property.
|
|
20
14
|
*/
|
|
@@ -46,7 +40,7 @@ export declare class NotebookModelFactory implements DocumentRegistry.IModelFact
|
|
|
46
40
|
*
|
|
47
41
|
* @returns A new document model.
|
|
48
42
|
*/
|
|
49
|
-
createNew(languagePreference?: string
|
|
43
|
+
createNew(languagePreference?: string): INotebookModel;
|
|
50
44
|
/**
|
|
51
45
|
* Get the preferred kernel language given a path.
|
|
52
46
|
*/
|
|
@@ -69,14 +63,5 @@ export declare namespace NotebookModelFactory {
|
|
|
69
63
|
* Defines if the document can be undo/redo.
|
|
70
64
|
*/
|
|
71
65
|
disableDocumentWideUndoRedo?: boolean;
|
|
72
|
-
/**
|
|
73
|
-
* The factory for code cell content.
|
|
74
|
-
*/
|
|
75
|
-
codeCellContentFactory?: CodeCellModel.IContentFactory;
|
|
76
|
-
/**
|
|
77
|
-
* The content factory used by the NotebookModelFactory. If
|
|
78
|
-
* given, it will supersede the `codeCellContentFactory`.
|
|
79
|
-
*/
|
|
80
|
-
contentFactory?: NotebookModel.IContentFactory;
|
|
81
66
|
}
|
|
82
67
|
}
|
package/lib/modelfactory.js
CHANGED
|
@@ -12,10 +12,6 @@ export class NotebookModelFactory {
|
|
|
12
12
|
this._disposed = false;
|
|
13
13
|
this._disableDocumentWideUndoRedo =
|
|
14
14
|
options.disableDocumentWideUndoRedo || false;
|
|
15
|
-
const codeCellContentFactory = options.codeCellContentFactory;
|
|
16
|
-
this.contentFactory =
|
|
17
|
-
options.contentFactory ||
|
|
18
|
-
new NotebookModel.ContentFactory({ codeCellContentFactory });
|
|
19
15
|
}
|
|
20
16
|
/**
|
|
21
17
|
* Define the disableDocumentWideUndoRedo property.
|
|
@@ -60,13 +56,9 @@ export class NotebookModelFactory {
|
|
|
60
56
|
*
|
|
61
57
|
* @returns A new document model.
|
|
62
58
|
*/
|
|
63
|
-
createNew(languagePreference
|
|
64
|
-
const contentFactory = this.contentFactory;
|
|
59
|
+
createNew(languagePreference) {
|
|
65
60
|
return new NotebookModel({
|
|
66
61
|
languagePreference,
|
|
67
|
-
contentFactory,
|
|
68
|
-
modelDB,
|
|
69
|
-
isInitialized,
|
|
70
62
|
disableDocumentWideUndoRedo: this._disableDocumentWideUndoRedo
|
|
71
63
|
});
|
|
72
64
|
}
|