UNPKG

2.49 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 * Get whether the model factory has been disposed.
36 */
37 get isDisposed(): boolean;
38 /**
39 * Dispose of the model factory.
40 */
41 dispose(): void;
42 /**
43 * Create a new model for a given path.
44 *
45 * @param languagePreference - An optional kernel language preference.
46 *
47 * @returns A new document model.
48 */
49 createNew(languagePreference?: string, modelDB?: IModelDB, isInitialized?: boolean): INotebookModel;
50 /**
51 * Get the preferred kernel language given a path.
52 */
53 preferredLanguage(path: string): string;
54 /**
55 * Defines if the document can be undo/redo.
56 */
57 private _disableDocumentWideUndoRedo;
58 private _disposed;
59}
60/**
61 * The namespace for notebook model factory statics.
62 */
63export declare namespace NotebookModelFactory {
64 /**
65 * The options used to initialize a NotebookModelFactory.
66 */
67 interface IOptions {
68 /**
69 * Defines if the document can be undo/redo.
70 */
71 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 }
82}