@jupyterlab/docregistry

  • Version 3.6.2
  • Published
  • 201 kB
  • 18 dependencies
  • BSD-3-Clause license

Install

npm i @jupyterlab/docregistry
yarn add @jupyterlab/docregistry
pnpm add @jupyterlab/docregistry

Overview

docregistry

Index

Classes

Interfaces

Namespaces

Classes

class ABCWidgetFactory

abstract class ABCWidgetFactory<
T extends IDocumentWidget,
U extends DocumentRegistry.IModel = DocumentRegistry.IModel
> implements DocumentRegistry.IWidgetFactory<T, U> {}
  • The default implementation of a widget factory.

constructor

constructor(options: DocumentRegistry.IWidgetFactoryOptions<T>);
  • Construct a new ABCWidgetFactory.

property canStartKernel

readonly canStartKernel: boolean;
  • Whether the widgets can start a kernel when opened.

property defaultFor

readonly defaultFor: string[];
  • The file types for which the factory should be the default.

property defaultRendered

readonly defaultRendered: string[];
  • The file types for which the factory should be the default for rendering a document model, if different from editing.

property fileTypes

readonly fileTypes: string[];
  • The file types the widget can view.

property isDisposed

readonly isDisposed: boolean;
  • Get whether the model factory has been disposed.

property modelName

readonly modelName: string;
  • The registered name of the model type used to create the widgets.

property name

readonly name: string;
  • The name of the widget to display in dialogs.

property preferKernel

readonly preferKernel: boolean;
  • Whether the widgets prefer having a kernel started.

property readOnly

readonly readOnly: boolean;
  • Whether the widget factory is read only.

property shutdownOnClose

shutdownOnClose: boolean;
  • Whether the kernel should be shutdown when the widget is closed.

property translator

readonly translator: ITranslator;
  • The application language translator.

property widgetCreated

readonly widgetCreated: ISignal<DocumentRegistry.IWidgetFactory<T, U>, T>;
  • A signal emitted when a widget is created.

method createNew

createNew: (context: DocumentRegistry.IContext<U>, source?: T) => T;
  • Create a new widget given a document model and a context.

    #### Notes It should emit the [widgetCreated] signal with the new widget.

method createNewWidget

protected abstract createNewWidget: (
context: DocumentRegistry.IContext<U>,
source?: T
) => T;
  • Create a widget for a context.

method defaultToolbarFactory

protected defaultToolbarFactory: (widget: T) => DocumentRegistry.IToolbarItem[];
  • Default factory for toolbar items to be added after the widget is created.

method dispose

dispose: () => void;
  • Dispose of the resources used by the document manager.

class Base64ModelFactory

class Base64ModelFactory extends TextModelFactory {}
  • An implementation of a model factory for base64 files.

property contentType

readonly contentType: Contents.ContentType;
  • The type of the file.

    #### Notes This is a read-only property.

property fileFormat

readonly fileFormat: Contents.FileFormat;
  • The format of the file.

    This is a read-only property.

property name

readonly name: string;
  • The name of the model type.

    #### Notes This is a read-only property.

class Context

class Context<T extends DocumentRegistry.IModel = DocumentRegistry.IModel>
implements DocumentRegistry.IContext<T> {}
  • An implementation of a document context.

    This class is typically instantiated by the document manager.

constructor

constructor(options: Context.IOptions<T>);
  • Construct a new document context.

property canSave

readonly canSave: boolean;
  • Whether the document can be saved via the Contents API.

property contentsModel

readonly contentsModel: any;
  • The current contents model associated with the document.

    #### Notes The contents model will be null until the context is populated. It will have an empty contents field.

property disposed

readonly disposed: ISignal<this, void>;
  • A signal emitted when the context is disposed.

property factoryName

readonly factoryName: string;
  • Get the model factory name.

    #### Notes This is not part of the IContext API.

property fileChanged

readonly fileChanged: ISignal<this, Contents.IModel>;
  • A signal emitted when the model is saved or reverted.

property isDisposed

readonly isDisposed: boolean;
  • Test whether the context is disposed.

property isReady

readonly isReady: boolean;
  • Whether the context is ready.

property lastModifiedCheckMargin

lastModifiedCheckMargin: number;
  • Configurable margin used to detect document modification conflicts, in milliseconds

property localPath

readonly localPath: string;
  • The current local path associated with the document. If the document is in the default notebook file browser, this is the same as the path.

property model

readonly model: DocumentRegistry.IModel;
  • Get the model associated with the document.

property path

readonly path: string;
  • The current path associated with the document.

property pathChanged

readonly pathChanged: ISignal<this, string>;
  • A signal emitted when the path changes.

property ready

readonly ready: Promise<void>;
  • A promise that is fulfilled when the context is ready.

property saveState

readonly saveState: ISignal<this, DocumentRegistry.SaveState>;
  • A signal emitted on the start and end of a saving operation.

property sessionContext

readonly sessionContext: SessionContext;
  • The client session object associated with the context.

property translator

protected translator: ITranslator;

    property urlResolver

    readonly urlResolver: IRenderMime.IResolver;
    • The url resolver for the context.

    method addSibling

    addSibling: (
    widget: Widget,
    options?: DocumentRegistry.IOpenOptions
    ) => IDisposable;
    • Add a sibling widget to the document manager.

      Parameter widget

      The widget to add to the document manager.

      Parameter options

      The desired options for adding the sibling.

      Returns

      A disposable used to remove the sibling if desired.

      #### Notes It is assumed that the widget has the same model and context as the original widget.

    method createCheckpoint

    createCheckpoint: () => Promise<Contents.ICheckpointModel>;
    • Create a checkpoint for the file.

    method deleteCheckpoint

    deleteCheckpoint: (checkpointId: string) => Promise<void>;
    • Delete a checkpoint for the file.

    method dispose

    dispose: () => void;
    • Dispose of the resources held by the context.

    method download

    download: () => Promise<void>;
    • Download a file.

      Parameter path

      The path of the file to be downloaded.

      Returns

      A promise which resolves when the file has begun downloading.

    method initialize

    initialize: (isNew: boolean) => Promise<void>;
    • Initialize the context.

      Parameter isNew

      Whether it is a new file.

      Returns

      a promise that resolves upon initialization.

    method listCheckpoints

    listCheckpoints: () => Promise<Contents.ICheckpointModel[]>;
    • List available checkpoints for a file.

    method onStateChanged

    protected onStateChanged: (
    sender: ISharedDocument,
    changes: DocumentChange
    ) => void;

      method rename

      rename: (newName: string) => Promise<void>;
      • Rename the document.

        Parameter newName

        the new name for the document.

      method restoreCheckpoint

      restoreCheckpoint: (checkpointId?: string) => Promise<void>;
      • Restore the file to a known checkpoint state.

      method revert

      revert: () => Promise<void>;
      • Revert the document contents to disk contents.

      method save

      save: () => Promise<void>;
      • Save the document contents to disk.

      method saveAs

      saveAs: () => Promise<void>;
      • Save the document to a different path chosen by the user.

        It will be rejected if the user abort providing a new path.

      class DocumentModel

      class DocumentModel
      extends CodeEditor.Model
      implements DocumentRegistry.ICodeModel {}
      • The default implementation of a document model.

      constructor

      constructor(
      languagePreference?: string,
      modelDB?: IModelDB,
      collaborationEnabled?: boolean
      );
      • Construct a new document model.

      property collaborative

      readonly collaborative: boolean;
      • Whether the model is collaborative or not.

      property contentChanged

      readonly contentChanged: ISignal<this, void>;
      • A signal emitted when the document content changes.

      property defaultKernelLanguage

      readonly defaultKernelLanguage: string;
      • The default kernel language of the document.

        #### Notes This is a read-only property.

      property defaultKernelName

      readonly defaultKernelName: string;
      • The default kernel name of the document.

        #### Notes This is a read-only property.

      property dirty

      dirty: boolean;
      • The dirty state of the document.

      property readOnly

      readOnly: boolean;
      • The read only state of the document.

      property sharedModel

      readonly sharedModel: models.ISharedFile;
      • The shared notebook model.

      property stateChanged

      readonly stateChanged: ISignal<this, IChangedArgs<any>>;
      • A signal emitted when the document state changes.

      method fromJSON

      fromJSON: (value: PartialJSONValue) => void;
      • Deserialize the model from JSON.

        #### Notes Should emit a [contentChanged] signal.

      method fromString

      fromString: (value: string) => void;
      • Deserialize the model from a string.

        #### Notes Should emit a [contentChanged] signal.

      method initialize

      initialize: () => void;
      • Initialize the model with its current state.

      method toJSON

      toJSON: () => PartialJSONValue;
      • Serialize the model to JSON.

      method toString

      toString: () => string;
      • Serialize the model to a string.

      method triggerContentChange

      protected triggerContentChange: () => void;
      • Trigger a content changed signal.

      method triggerStateChange

      protected triggerStateChange: (args: IChangedArgs<any>) => void;
      • Trigger a state change signal.

      class DocumentRegistry

      class DocumentRegistry implements IDisposable {}
      • The document registry.

      constructor

      constructor(options?: DocumentRegistry.IOptions);
      • Construct a new document registry.

      property changed

      readonly changed: ISignal<this, DocumentRegistry.IChangedArgs>;
      • A signal emitted when the registry has changed.

      property isDisposed

      readonly isDisposed: boolean;
      • Get whether the document registry has been disposed.

      property translator

      protected translator: ITranslator;

        method addFileType

        addFileType: (
        fileType: Partial<DocumentRegistry.IFileType>,
        factories?: string[]
        ) => IDisposable;
        • Add a file type to the document registry.

          Parameter fileType

          The file type object to register.

          Parameter factories

          Optional factories to use for the file type.

          Returns

          A disposable which will unregister the command.

          #### Notes These are used to populate the "Create New" dialog.

          If no default factory exists for the file type, the first factory will be defined as default factory.

        method addModelFactory

        addModelFactory: (factory: DocumentRegistry.ModelFactory) => IDisposable;
        • Add a model factory to the registry.

          Parameter factory

          The factory instance.

          Returns

          A disposable which will unregister the factory.

          #### Notes If a factory with the given name is already registered, or the given factory is already registered, a warning will be logged and this will be a no-op.

        method addWidgetExtension

        addWidgetExtension: (
        widgetName: string,
        extension: DocumentRegistry.WidgetExtension
        ) => IDisposable;
        • Add a widget extension to the registry.

          Parameter widgetName

          The name of the widget factory.

          Parameter extension

          A widget extension.

          Returns

          A disposable which will unregister the extension.

          #### Notes If the extension is already registered for the given widget name, a warning will be logged and this will be a no-op.

        method addWidgetFactory

        addWidgetFactory: (factory: DocumentRegistry.WidgetFactory) => IDisposable;
        • Add a widget factory to the registry.

          Parameter factory

          The factory instance to register.

          Returns

          A disposable which will unregister the factory.

          #### Notes If a factory with the given 'name' is already registered, a warning will be logged, and this will be a no-op. If '*' is given as a default extension, the factory will be registered as the global default. If an extension or global default is already registered, this factory will override the existing default. The factory cannot be named an empty string or the string 'default'.

        method defaultRenderedWidgetFactory

        defaultRenderedWidgetFactory: (path: string) => DocumentRegistry.WidgetFactory;
        • Get the default rendered widget factory for a path.

          Parameter path

          The path to for which to find a widget factory.

          Returns

          The default rendered widget factory for the path.

          ### Notes If the widget factory has registered a separate set of defaultRendered file types and there is a match in that set, this returns that. Otherwise, this returns the same widget factory as [[defaultWidgetFactory]].

          The user setting defaultViewers took precedence on this one too.

        method defaultWidgetFactory

        defaultWidgetFactory: (path?: string) => DocumentRegistry.WidgetFactory;
        • Get the default widget factory for a path.

          Parameter path

          An optional file path to filter the results.

          Returns

          The default widget factory for an path.

          #### Notes This is equivalent to the first value in [[preferredWidgetFactories]].

        method dispose

        dispose: () => void;
        • Dispose of the resources held by the document registry.

        method fileTypes

        fileTypes: () => IIterator<DocumentRegistry.IFileType>;
        • Create an iterator over the file types that have been registered.

          Returns

          A new iterator of file types.

        method getFileType

        getFileType: (name: string) => DocumentRegistry.IFileType | undefined;
        • Get a file type by name.

        method getFileTypeForModel

        getFileTypeForModel: (model: Contents.IModel) => DocumentRegistry.IFileType;
        • Get the best file type given a contents model.

          Parameter model

          The contents model of interest.

          Returns

          The best matching file type.

        method getFileTypesForPath

        getFileTypesForPath: (path: string) => DocumentRegistry.IFileType[];
        • Get the file types that match a file name.

          Parameter path

          The path of the file.

          Returns

          An ordered list of matching file types.

        method getKernelPreference

        getKernelPreference: (
        path: string,
        widgetName: string,
        kernel?: Kernel.IModel
        ) => ISessionContext.IKernelPreference | undefined;
        • Get a kernel preference.

          Parameter path

          The file path.

          Parameter widgetName

          The name of the widget factory.

          Parameter kernel

          An optional existing kernel model.

          Returns

          A kernel preference.

        method getModelFactory

        getModelFactory: (name: string) => DocumentRegistry.ModelFactory | undefined;
        • Get a model factory by name.

          Parameter name

          The name of the model factory.

          Returns

          A model factory instance.

        method getWidgetFactory

        getWidgetFactory: (
        widgetName: string
        ) => DocumentRegistry.WidgetFactory | undefined;
        • Get a widget factory by name.

          Parameter widgetName

          The name of the widget factory.

          Returns

          A widget factory instance.

        method modelFactories

        modelFactories: () => IIterator<DocumentRegistry.ModelFactory>;
        • Create an iterator over the model factories that have been registered.

          Returns

          A new iterator of model factories.

        method preferredWidgetFactories

        preferredWidgetFactories: (path: string) => DocumentRegistry.WidgetFactory[];
        • Get a list of the preferred widget factories.

          Parameter path

          The file path to filter the results.

          Returns

          A new array of widget factories.

          #### Notes Only the widget factories whose associated model factory have been registered will be returned. The first item is considered the default. The returned array has widget factories in the following order: - path-specific default factory - path-specific default rendered factory - global default factory - all other path-specific factories - all other global factories

        method setDefaultWidgetFactory

        setDefaultWidgetFactory: (fileType: string, factory: string | undefined) => void;
        • Set overrides for the default widget factory for a file type.

          Normally, a widget factory informs the document registry which file types it should be the default for using the defaultFor option in the IWidgetFactoryOptions. This function can be used to override that after the fact.

          Parameter fileType

          : The name of the file type.

          Parameter factory

          : The name of the factory.

          #### Notes If factory is undefined, then any override will be unset, and the default factory will revert to the original value.

          If factory or fileType are not known to the docregistry, or if factory cannot open files of type fileType, this will throw an error.

        method widgetExtensions

        widgetExtensions: (
        widgetName: string
        ) => IIterator<DocumentRegistry.WidgetExtension>;
        • Create an iterator over the registered extensions for a given widget.

          Parameter widgetName

          The name of the widget factory.

          Returns

          A new iterator over the widget extensions.

        method widgetFactories

        widgetFactories: () => IIterator<DocumentRegistry.WidgetFactory>;
        • Create an iterator over the widget factories that have been registered.

          Returns

          A new iterator of widget factories.

        class DocumentWidget

        class DocumentWidget<
        T extends Widget = Widget,
        U extends DocumentRegistry.IModel = DocumentRegistry.IModel
        >
        extends MainAreaWidget<T>
        implements IDocumentWidget<T, U> {}
        • A document widget implementation.

        constructor

        constructor(options: DocumentWidget.IOptions<T, U>);

          property context

          readonly context: DocumentRegistry.IContext<U>;

            property isUntitled

            isUntitled?: boolean;
            • Whether the document has an auto-generated name or not.

              #### Notes A document has auto-generated name if its name is untitled and up to the instant the user saves it manually for the first time.

            method setFragment

            setFragment: (fragment: string) => void;
            • Set URI fragment identifier.

            class MimeContent

            class MimeContent extends Widget {}
            • A content widget for a rendered mimetype document.

            constructor

            constructor(options: MimeContent.IOptions);
            • Construct a new widget.

            property mimeType

            readonly mimeType: string;
            • The mimetype for this rendered content.

            property ready

            readonly ready: Promise<void>;
            • A promise that resolves when the widget is ready.

            property renderer

            readonly renderer: IRenderMime.IRenderer;

              property translator

              protected translator: ITranslator;

                method [Printing.symbol]

                [Printing.symbol]: () => Printing.OptionalAsyncThunk;
                • Print method. Deferred to the renderer.

                method dispose

                dispose: () => void;
                • Dispose of the resources held by the widget.

                method onUpdateRequest

                protected onUpdateRequest: (msg: Message) => void;
                • Handle an update-request message to the widget.

                method setFragment

                setFragment: (fragment: string) => void;
                • Set URI fragment identifier.

                class MimeDocument

                class MimeDocument extends DocumentWidget<MimeContent> {}
                • A document widget for mime content.

                method setFragment

                setFragment: (fragment: string) => void;

                  class MimeDocumentFactory

                  class MimeDocumentFactory extends ABCWidgetFactory<MimeDocument> {}
                  • An implementation of a widget factory for a rendered mimetype document.

                  constructor

                  constructor(options: MimeDocumentFactory.IOptions<MimeDocument>);
                  • Construct a new mimetype widget factory.

                  method createNewWidget

                  protected createNewWidget: (context: DocumentRegistry.Context) => MimeDocument;
                  • Create a new widget given a context.

                  class TextModelFactory

                  class TextModelFactory implements DocumentRegistry.CodeModelFactory {}
                  • An implementation of a model factory for text files.

                  constructor

                  constructor(collaborative?: boolean);
                  • Instantiates a TextModelFactory.

                  property collaborative

                  readonly collaborative: boolean;
                  • Whether the model is collaborative or not.

                  property contentType

                  readonly contentType: Contents.ContentType;
                  • The type of the file.

                    #### Notes This is a read-only property.

                  property fileFormat

                  readonly fileFormat: Contents.FileFormat;
                  • The format of the file.

                    This is a read-only property.

                  property isDisposed

                  readonly isDisposed: boolean;
                  • Get whether the model factory has been disposed.

                  property name

                  readonly name: string;
                  • The name of the model type.

                    #### Notes This is a read-only property.

                  method createNew

                  createNew: (
                  languagePreference?: string,
                  modelDB?: IModelDB,
                  isInitialized?: boolean,
                  collaborationEnabled?: boolean
                  ) => DocumentRegistry.ICodeModel;
                  • Create a new model.

                    Parameter languagePreference

                    An optional kernel language preference.

                    Parameter modelDB

                    An optional model storage.

                    Parameter isInitialized

                    Whether the model is initialized or not.

                    Parameter collaborationEnabled

                    Whether collaboration is enabled at the application level or not (default false).

                    Returns

                    A new document model.

                  method dispose

                  dispose: () => void;
                  • Dispose of the resources held by the model factory.

                  method preferredLanguage

                  preferredLanguage: (path: string) => string;
                  • Get the preferred kernel language given a file path.

                  Interfaces

                  interface IDocumentWidget

                  interface IDocumentWidget<
                  T extends Widget = Widget,
                  U extends DocumentRegistry.IModel = DocumentRegistry.IModel
                  > extends Widget {}
                  • An interface for a document widget.

                  property content

                  readonly content: T;
                  • The content widget.

                  property context

                  readonly context: DocumentRegistry.IContext<U>;
                  • The context associated with the document.

                  property isUntitled

                  isUntitled?: boolean;
                  • Whether the document has an auto-generated name or not.

                    #### Notes A document has auto-generated name if its name is untitled and up to the instant the user saves it manually for the first time.

                  property revealed

                  readonly revealed: Promise<void>;
                  • A promise resolving after the content widget is revealed.

                  property toolbar

                  readonly toolbar: Toolbar<Widget>;
                  • The toolbar for the widget.

                  method setFragment

                  setFragment: (fragment: string) => void;
                  • Set URI fragment identifier.

                  Namespaces

                  namespace Context

                  namespace Context {}
                  • A namespace for Context statics.

                  interface IOptions

                  interface IOptions<T extends DocumentRegistry.IModel> {}
                  • The options used to initialize a context.

                  property collaborative

                  collaborative?: boolean;
                  • Whether the model is collaborative.

                    Deprecated

                    It will be removed in 4.0.0. The collaborative feature is provided by the DocumentRegistry.IModel (can be customized by the DocumentRegistry.IModelFactory)

                  property docProviderFactory

                  docProviderFactory?: IDocumentProviderFactory<ISharedDocument>;
                  • An factory method for the document provider.

                  property factory

                  factory: DocumentRegistry.IModelFactory<T>;
                  • The model factory used to create the model.

                  property kernelPreference

                  kernelPreference?: ISessionContext.IKernelPreference;
                  • The kernel preference associated with the context.

                  property lastModifiedCheckMargin

                  lastModifiedCheckMargin?: number;
                  • Max acceptable difference, in milliseconds, between last modified timestamps on disk and client

                  property manager

                  manager: ServiceManager.IManager;
                  • A service manager instance.

                  property modelDBFactory

                  modelDBFactory?: ModelDB.IFactory;
                  • An IModelDB factory method which may be used for the document.

                  property opener

                  opener?: (widget: Widget) => void;
                  • An optional callback for opening sibling widgets.

                  property path

                  path: string;
                  • The initial path of the file.

                  property sessionDialogs

                  sessionDialogs?: ISessionContext.IDialogs;
                  • The dialogs used for the session context.

                  property setBusy

                  setBusy?: () => IDisposable;
                  • A function to call when the kernel is busy.

                  property translator

                  translator?: ITranslator;
                  • The application language translator.

                  namespace DocumentRegistry

                  namespace DocumentRegistry {}
                  • The namespace for the DocumentRegistry class statics.

                  function getDefaultDirectoryFileType

                  getDefaultDirectoryFileType: (translator?: ITranslator) => IFileType;
                  • The default directory file type used by the document registry.

                    Parameter translator

                    The application language translator.

                    Returns

                    The default directory file type.

                  function getDefaultFileTypes

                  getDefaultFileTypes: (
                  translator?: ITranslator
                  ) => ReadonlyArray<Partial<IFileType>>;
                  • The default file types used by the document registry.

                    Parameter translator

                    The application language translator.

                    Returns

                    The default directory file types.

                  function getDefaultNotebookFileType

                  getDefaultNotebookFileType: (translator?: ITranslator) => IFileType;
                  • The default notebook file type used by the document registry.

                    Parameter translator

                    The application language translator.

                    Returns

                    The default notebook file type.

                  function getDefaultTextFileType

                  getDefaultTextFileType: (translator?: ITranslator) => IFileType;
                  • The default text file type used by the document registry.

                    Parameter translator

                    The application language translator.

                    Returns

                    The default text file type.

                  function getFileTypeDefaults

                  getFileTypeDefaults: (translator?: ITranslator) => IFileType;
                  • The defaults used for a file type.

                    Parameter translator

                    The application language translator.

                    Returns

                    The default file type.

                  interface IChangedArgs

                  interface IChangedArgs {}
                  • An arguments object for the changed signal.

                  property change

                  readonly change: 'added' | 'removed';
                  • Whether the item was added or removed.

                  property name

                  readonly name?: string;
                  • The name of the item or the widget factory being extended.

                  property type

                  readonly type: 'widgetFactory' | 'modelFactory' | 'widgetExtension' | 'fileType';
                  • The type of the changed item.

                  interface ICodeModel

                  interface ICodeModel extends IModel, CodeEditor.IModel {}
                  • The interface for a document model that represents code.

                  property sharedModel

                  sharedModel: ISharedFile;

                    interface IContext

                    interface IContext<T extends IModel> extends IDisposable {}
                    • The document context object.

                    property contentsModel

                    readonly contentsModel: Contents.IModel | null;
                    • The document metadata, stored as a services contents model.

                      #### Notes This will be null until the context is 'ready'. Since we only store metadata here, the .contents attribute will always be empty.

                    property disposed

                    disposed: ISignal<this, void>;
                    • A signal emitted when the context is disposed.

                    property fileChanged

                    fileChanged: ISignal<this, Contents.IModel>;
                    • A signal emitted when the contentsModel changes.

                    property isReady

                    readonly isReady: boolean;
                    • Whether the context is ready.

                    property lastModifiedCheckMargin

                    lastModifiedCheckMargin: number;
                    • Configurable margin used to detect document modification conflicts, in milliseconds

                    property localPath

                    readonly localPath: string;
                    • The current local path associated with the document. If the document is in the default notebook file browser, this is the same as the path.

                    property model

                    readonly model: T;
                    • The data model for the document.

                    property path

                    readonly path: string;
                    • The current path associated with the document.

                    property pathChanged

                    pathChanged: ISignal<this, string>;
                    • A signal emitted when the path changes.

                    property ready

                    readonly ready: Promise<void>;
                    • A promise that is fulfilled when the context is ready.

                    property saveState

                    saveState: ISignal<this, SaveState>;
                    • A signal emitted on the start and end of a saving operation.

                    property sessionContext

                    readonly sessionContext: ISessionContext;
                    • The session context object associated with the context.

                    property urlResolver

                    readonly urlResolver: IRenderMime.IResolver;
                    • The url resolver for the context.

                    method addSibling

                    addSibling: (widget: Widget, options?: IOpenOptions) => IDisposable;
                    • Add a sibling widget to the document manager.

                      Parameter widget

                      The widget to add to the document manager.

                      Parameter options

                      The desired options for adding the sibling.

                      Returns

                      A disposable used to remove the sibling if desired.

                      #### Notes It is assumed that the widget has the same model and context as the original widget.

                    method createCheckpoint

                    createCheckpoint: () => Promise<Contents.ICheckpointModel>;
                    • Create a checkpoint for the file.

                      Returns

                      A promise which resolves with the new checkpoint model when the checkpoint is created.

                    method deleteCheckpoint

                    deleteCheckpoint: (checkpointID: string) => Promise<void>;
                    • Delete a checkpoint for the file.

                      Parameter checkpointID

                      The id of the checkpoint to delete.

                      Returns

                      A promise which resolves when the checkpoint is deleted.

                    method download

                    download: () => Promise<void>;
                    • Save the document to a different path chosen by the user.

                    method listCheckpoints

                    listCheckpoints: () => Promise<Contents.ICheckpointModel[]>;
                    • List available checkpoints for the file.

                      Returns

                      A promise which resolves with a list of checkpoint models for the file.

                    method rename

                    rename: (newName: string) => Promise<void>;
                    • Rename the document.

                    method restoreCheckpoint

                    restoreCheckpoint: (checkpointID?: string) => Promise<void>;
                    • Restore the file to a known checkpoint state.

                      Parameter checkpointID

                      The optional id of the checkpoint to restore, defaults to the most recent checkpoint.

                      Returns

                      A promise which resolves when the checkpoint is restored.

                    method revert

                    revert: () => Promise<void>;
                    • Revert the document contents to disk contents.

                    method save

                    save: () => Promise<void>;
                    • Save the document contents to disk.

                    method saveAs

                    saveAs: () => Promise<void>;
                    • Save the document to a different path chosen by the user.

                    interface IFileType

                    interface IFileType {}
                    • An interface for a file type.

                    property contentType

                    readonly contentType: Contents.ContentType;
                    • The content type of the new file.

                    property displayName

                    readonly displayName?: string;
                    • An optional display name for the file type.

                    property extensions

                    readonly extensions: ReadonlyArray<string>;
                    • The extensions of the file type (e.g. ".txt"). Can be a compound extension (e.g. ".table.json).

                    property fileFormat

                    readonly fileFormat: Contents.FileFormat;
                    • The format of the new file.

                    property icon

                    readonly icon?: LabIcon;
                    • The icon for the file type.

                    property iconClass

                    readonly iconClass?: string;
                    • The icon class name for the file type.

                    property iconLabel

                    readonly iconLabel?: string;
                    • The icon label for the file type.

                    property mimeTypes

                    readonly mimeTypes: ReadonlyArray<string>;
                    • The mime types associated the file type.

                    property name

                    readonly name: string;
                    • The name of the file type.

                    property pattern

                    readonly pattern?: string;
                    • An optional pattern for a file name (e.g. ^Dockerfile$).

                    interface IModel

                    interface IModel extends IDisposable {}
                    • The interface for a document model.

                    property collaborative

                    readonly collaborative?: boolean;
                    • Whether this document model supports collaboration when the collaborative flag is enabled globally. Defaults to false.

                    property contentChanged

                    contentChanged: ISignal<this, void>;
                    • A signal emitted when the document content changes.

                    property defaultKernelLanguage

                    readonly defaultKernelLanguage: string;
                    • The default kernel language of the document.

                    property defaultKernelName

                    readonly defaultKernelName: string;
                    • The default kernel name of the document.

                    property dirty

                    dirty: boolean;
                    • The dirty state of the model.

                      #### Notes This should be cleared when the document is loaded from or saved to disk.

                    property modelDB

                    readonly modelDB: IModelDB;
                    • The underlying IModelDB instance in which model data is stored.

                      ### Notes Making direct edits to the values stored in theIModelDB is not recommended, and may produce unpredictable results.

                    property readOnly

                    readOnly: boolean;
                    • The read-only state of the model.

                    property sharedModel

                    readonly sharedModel: ISharedDocument;
                    • The shared notebook model.

                    property stateChanged

                    stateChanged: ISignal<this, IChangedArgsGeneric<any>>;
                    • A signal emitted when the model state changes.

                    method fromJSON

                    fromJSON: (value: ReadonlyPartialJSONValue) => void;
                    • Deserialize the model from JSON.

                      #### Notes Should emit a [contentChanged] signal.

                    method fromString

                    fromString: (value: string) => void;
                    • Deserialize the model from a string.

                      #### Notes Should emit a [contentChanged] signal.

                    method initialize

                    initialize: () => void;
                    • Initialize model state after initial data load.

                      #### Notes This function must be called after the initial data is loaded to set up initial model state, such as an initial undo stack, etc.

                    method toJSON

                    toJSON: () => PartialJSONValue;
                    • Serialize the model to JSON.

                    method toString

                    toString: () => string;
                    • Serialize the model to a string.

                    interface IModelFactory

                    interface IModelFactory<T extends IModel> extends IDisposable {}
                    • The interface for a model factory.

                    property collaborative

                    readonly collaborative?: boolean;
                    • Whether the model is collaborative or not.

                    property contentType

                    readonly contentType: Contents.ContentType;
                    • The content type of the file (defaults to "file").

                    property fileFormat

                    readonly fileFormat: Contents.FileFormat;
                    • The format of the file (defaults to "text").

                    property name

                    readonly name: string;
                    • The name of the model.

                    method createNew

                    createNew: (
                    languagePreference?: string,
                    modelDB?: IModelDB,
                    isInitialized?: boolean,
                    collaborationEnabled?: boolean
                    ) => T;
                    • Create a new model for a given path.

                      Parameter languagePreference

                      An optional kernel language preference.

                      Parameter modelDB

                      An optional model storage.

                      Parameter isInitialized

                      Whether the model is initialized or not.

                      Parameter collaborationEnabled

                      Whether collaboration is enabled at the application level or not (default false).

                      Returns

                      A new document model.

                    method preferredLanguage

                    preferredLanguage: (path: string) => string;
                    • Get the preferred kernel language given a file path.

                    interface IOpenOptions

                    interface IOpenOptions {}
                    • The options used to open a widget.

                    property activate

                    activate?: boolean;
                    • Whether to activate the widget. Defaults to true.

                    property mode

                    mode?: DockLayout.InsertMode;
                    • The supported insertion modes.

                      An insert mode is used to specify how a widget should be added to the main area relative to a reference widget.

                    property rank

                    rank?: number;
                    • The rank order of the widget among its siblings.

                      #### Notes This field may be used or ignored depending on shell implementation.

                    property ref

                    ref?: string | null;
                    • The reference widget id for the insert location.

                      The default is null.

                    interface IOptions

                    interface IOptions {}
                    • The options used to create a document registry.

                    property initialFileTypes

                    initialFileTypes?: DocumentRegistry.IFileType[];
                    • The initial file types for the registry. The [[DocumentRegistry.defaultFileTypes]] will be used if not given.

                    property textModelFactory

                    textModelFactory?: ModelFactory;
                    • The text model factory for the registry. A default instance will be used if not given.

                    property translator

                    translator?: ITranslator;
                    • The application language translator.

                    interface IToolbarItem

                    interface IToolbarItem extends ToolbarRegistry.IToolbarItem {}
                    • The item to be added to document toolbar.

                    interface IWidgetExtension

                    interface IWidgetExtension<T extends Widget, U extends IModel> {}
                    • An interface for a widget extension.

                    method createNew

                    createNew: (widget: T, context: IContext<U>) => IDisposable | void;
                    • Create a new extension for a given widget.

                    interface IWidgetFactory

                    interface IWidgetFactory<T extends IDocumentWidget, U extends IModel>
                    extends IDisposable,
                    IWidgetFactoryOptions {}
                    • The interface for a widget factory.

                    property widgetCreated

                    widgetCreated: ISignal<IWidgetFactory<T, U>, T>;
                    • A signal emitted when a new widget is created.

                    method createNew

                    createNew: (context: IContext<U>, source?: T) => T;
                    • Create a new widget given a context.

                      Parameter source

                      A widget to clone

                      #### Notes It should emit the [widgetCreated] signal with the new widget.

                    interface IWidgetFactoryOptions

                    interface IWidgetFactoryOptions<T extends Widget = Widget> {}
                    • The options used to initialize a widget factory.

                    property canStartKernel

                    readonly canStartKernel?: boolean;
                    • Whether the widgets can start a kernel when opened.

                    property defaultFor

                    readonly defaultFor?: ReadonlyArray<string>;
                    • The file types for which the factory should be the default.

                    property defaultRendered

                    readonly defaultRendered?: ReadonlyArray<string>;
                    • The file types for which the factory should be the default for rendering, if that is different than the default factory (which may be for editing). If undefined, then it will fall back on the default file type.

                    property fileTypes

                    readonly fileTypes: ReadonlyArray<string>;
                    • The file types the widget can view.

                    property modelName

                    readonly modelName?: string;
                    • The registered name of the model type used to create the widgets.

                    property name

                    readonly name: string;
                    • The name of the widget to display in dialogs.

                    property preferKernel

                    readonly preferKernel?: boolean;
                    • Whether the widgets prefer having a kernel started.

                    property readOnly

                    readonly readOnly?: boolean;
                    • Whether the widget factory is read only.

                    property shutdownOnClose

                    readonly shutdownOnClose?: boolean;
                    • Whether the kernel should be shutdown when the widget is closed.

                    property toolbarFactory

                    readonly toolbarFactory?: (
                    widget: T
                    ) =>
                    | DocumentRegistry.IToolbarItem[]
                    | IObservableList<DocumentRegistry.IToolbarItem>;
                    • A function producing toolbar widgets, overriding the default toolbar widgets.

                    property translator

                    readonly translator?: ITranslator;
                    • The application language translator.

                    type CodeContext

                    type CodeContext = IContext<ICodeModel>;
                    • A type alias for a code context.

                    type CodeModelFactory

                    type CodeModelFactory = IModelFactory<ICodeModel>;
                    • A type alias for a code model factory.

                    type Context

                    type Context = IContext<IModel>;
                    • A type alias for a context.

                    type ModelFactory

                    type ModelFactory = IModelFactory<IModel>;
                    • A type alias for a standard model factory.

                    type SaveState

                    type SaveState = 'started' | 'failed' | 'completed';
                    • Document save state

                    type WidgetExtension

                    type WidgetExtension = IWidgetExtension<Widget, IModel>;
                    • A type alias for a standard widget extension.

                    type WidgetFactory

                    type WidgetFactory = IWidgetFactory<IDocumentWidget, IModel>;
                    • A type alias for a standard widget factory.

                    namespace DocumentWidget

                    namespace DocumentWidget {}

                      interface IOptions

                      interface IOptions<
                      T extends Widget = Widget,
                      U extends DocumentRegistry.IModel = DocumentRegistry.IModel
                      > extends MainAreaWidget.IOptions<T> {}

                        property context

                        context: DocumentRegistry.IContext<U>;

                          interface IOptionsOptionalContent

                          interface IOptionsOptionalContent<
                          T extends Widget = Widget,
                          U extends DocumentRegistry.IModel = DocumentRegistry.IModel
                          > extends MainAreaWidget.IOptionsOptionalContent<T> {}

                            property context

                            context: DocumentRegistry.IContext<U>;

                              property translator

                              translator?: ITranslator;
                              • The application language translator.

                              namespace MimeContent

                              namespace MimeContent {}
                              • The namespace for MimeDocument class statics.

                              interface IOptions

                              interface IOptions {}
                              • The options used to initialize a MimeDocument.

                              property context

                              context: DocumentRegistry.IContext<DocumentRegistry.IModel>;
                              • Context

                              property dataType

                              dataType?: 'string' | 'json';
                              • Preferred data type from the model.

                              property mimeType

                              mimeType: string;
                              • The mime type.

                              property renderer

                              renderer: IRenderMime.IRenderer;
                              • The renderer instance.

                              property renderTimeout

                              renderTimeout: number;
                              • The render timeout.

                              property translator

                              translator?: ITranslator;
                              • The application language translator.

                              namespace MimeDocumentFactory

                              namespace MimeDocumentFactory {}
                              • The namespace for MimeDocumentFactory class statics.

                              interface IOptions

                              interface IOptions<T extends MimeDocument>
                              extends DocumentRegistry.IWidgetFactoryOptions<T> {}
                              • The options used to initialize a MimeDocumentFactory.

                              property dataType

                              dataType?: 'string' | 'json';
                              • Preferred data type from the model.

                              property factory

                              factory?: IRenderMime.IRendererFactory;
                              • Optional renderer to use (overriding the renderer in the registry)

                              property primaryFileType

                              primaryFileType: DocumentRegistry.IFileType | undefined;
                              • The primary file type associated with the document.

                              property rendermime

                              rendermime: IRenderMimeRegistry;
                              • The rendermime instance.

                              property renderTimeout

                              renderTimeout?: number;
                              • The render timeout.

                              Package Files (5)

                              Dependencies (18)

                              Dev Dependencies (7)

                              Peer Dependencies (0)

                              No peer dependencies.

                              Badge

                              To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                              You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@jupyterlab/docregistry.

                              • Markdown
                                [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@jupyterlab/docregistry)
                              • HTML
                                <a href="https://www.jsdocs.io/package/@jupyterlab/docregistry"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>