UNPKG

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