UNPKG

3 kBTypeScriptView Raw
1import { CodeCellModel } from '@jupyterlab/cells';
2import { DocumentRegistry } from '@jupyterlab/docregistry';
3import { IModelDB } from '@jupyterlab/observables';
4import { Contents } from '@jupyterlab/services';
5import { INotebookModel, NotebookModel } from './model';
6/**
7 * A model factory for notebooks.
8 */
9export declare class NotebookModelFactory implements DocumentRegistry.IModelFactory<INotebookModel> {
10 /**
11 * Construct a new notebook model factory.
12 */
13 constructor(options: NotebookModelFactory.IOptions);
14 /**
15 * The content model factory used by the NotebookModelFactory.
16 */
17 readonly contentFactory: NotebookModel.IContentFactory;
18 /**
19 * Define the disableDocumentWideUndoRedo property.
20 */
21 set disableDocumentWideUndoRedo(disableDocumentWideUndoRedo: boolean);
22 /**
23 * The name of the model.
24 */
25 get name(): string;
26 /**
27 * The content type of the file.
28 */
29 get contentType(): Contents.ContentType;
30 /**
31 * The format of the file.
32 */
33 get fileFormat(): Contents.FileFormat;
34 /**
35 * Whether the model is collaborative or not.
36 */
37 get collaborative(): boolean;
38 /**
39 * Get whether the model factory has been disposed.
40 */
41 get isDisposed(): boolean;
42 /**
43 * Dispose of the model factory.
44 */
45 dispose(): void;
46 /**
47 * Create a new model for a given path.
48 *
49 * @param languagePreference - An optional kernel language preference.
50 * @param modelDB - An optional model storage.
51 * @param isInitialized - Whether the model is initialized or not.
52 * @param collaborationEnabled - Whether collaboration is enabled at the application level or not (default `false`).
53 *
54 * @returns A new document model.
55 */
56 createNew(languagePreference?: string, modelDB?: IModelDB, isInitialized?: boolean, collaborationEnabled?: boolean): INotebookModel;
57 /**
58 * Get the preferred kernel language given a path.
59 */
60 preferredLanguage(path: string): string;
61 /**
62 * Defines if the document can be undo/redo.
63 */
64 private _disableDocumentWideUndoRedo;
65 private _disposed;
66 private _collaborative;
67}
68/**
69 * The namespace for notebook model factory statics.
70 */
71export declare namespace NotebookModelFactory {
72 /**
73 * The options used to initialize a NotebookModelFactory.
74 */
75 interface IOptions {
76 /**
77 * Whether the model is collaborative or not.
78 */
79 collaborative?: boolean;
80 /**
81 * Defines if the document can be undo/redo.
82 */
83 disableDocumentWideUndoRedo?: boolean;
84 /**
85 * The factory for code cell content.
86 */
87 codeCellContentFactory?: CodeCellModel.IContentFactory;
88 /**
89 * The content factory used by the NotebookModelFactory. If
90 * given, it will supersede the `codeCellContentFactory`.
91 */
92 contentFactory?: NotebookModel.IContentFactory;
93 }
94}