@jupyterlab/notebook
Version:
JupyterLab - Notebook
88 lines • 2.31 kB
JavaScript
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
import { NotebookModel } from './model';
/**
* A model factory for notebooks.
*/
export class NotebookModelFactory {
/**
* Construct a new notebook model factory.
*/
constructor(options = {}) {
var _a, _b;
this._disposed = false;
this._disableDocumentWideUndoRedo =
(_a = options.disableDocumentWideUndoRedo) !== null && _a !== void 0 ? _a : true;
this._collaborative = (_b = options.collaborative) !== null && _b !== void 0 ? _b : true;
}
/**
* Define the disableDocumentWideUndoRedo property.
*
* @experimental
* @alpha
*/
get disableDocumentWideUndoRedo() {
return this._disableDocumentWideUndoRedo;
}
set disableDocumentWideUndoRedo(disableDocumentWideUndoRedo) {
this._disableDocumentWideUndoRedo = disableDocumentWideUndoRedo;
}
/**
* The name of the model.
*/
get name() {
return 'notebook';
}
/**
* The content type of the file.
*/
get contentType() {
return 'notebook';
}
/**
* The format of the file.
*/
get fileFormat() {
return 'json';
}
/**
* Whether the model is collaborative or not.
*/
get collaborative() {
return this._collaborative;
}
/**
* Get whether the model factory has been disposed.
*/
get isDisposed() {
return this._disposed;
}
/**
* Dispose of the model factory.
*/
dispose() {
this._disposed = true;
}
/**
* Create a new model for a given path.
*
* @param options Model options.
*
* @returns A new document model.
*/
createNew(options = {}) {
return new NotebookModel({
languagePreference: options.languagePreference,
sharedModel: options.sharedModel,
collaborationEnabled: options.collaborationEnabled && this.collaborative,
disableDocumentWideUndoRedo: this._disableDocumentWideUndoRedo
});
}
/**
* Get the preferred kernel language given a path.
*/
preferredLanguage(path) {
return '';
}
}
//# sourceMappingURL=modelfactory.js.map