Options
All
  • Public
  • Public/Protected
  • All
Menu

The document registry. The namespace for the DocumentRegistry class statics.

Hierarchy

  • DocumentRegistry

Implements

  • IDisposable

Index

Type aliases

Static CodeContext

CodeContext: IContext<ICodeModel>

A type alias for a code context.

Static CodeModelFactory

CodeModelFactory: IModelFactory<ICodeModel>

A type alias for a code model factory.

Static Context

Context: IContext<IModel>

A type alias for a context.

Static ModelFactory

ModelFactory: IModelFactory<IModel>

A type alias for a standard model factory.

Static SaveState

SaveState: "started" | "completed" | "failed"

Static WidgetExtension

WidgetExtension: IWidgetExtension<Widget, IModel>

A type alias for a standard widget extension.

Static WidgetFactory

A type alias for a standard widget factory.

Constructors

constructor

Properties

Private _changed

_changed: Signal<this, IChangedArgs> = new Signal<this, DocumentRegistry.IChangedArgs>(this)

Private _defaultRenderedWidgetFactories

_defaultRenderedWidgetFactories: {} = Object.create(null)

Type declaration

  • [key: string]: string

Private _defaultWidgetFactories

_defaultWidgetFactories: {} = Object.create(null)

Type declaration

  • [key: string]: string

Private _defaultWidgetFactory

_defaultWidgetFactory: string = ""

Private _defaultWidgetFactoryOverrides

_defaultWidgetFactoryOverrides: {} = Object.create(null)

Type declaration

  • [key: string]: string

Private _extenders

_extenders: {} = Object.create(null)

Type declaration

Private _fileTypes

_fileTypes: IFileType[] = []

Private _isDisposed

_isDisposed: boolean = false

Private _modelFactories

_modelFactories: {} = Object.create(null)

Type declaration

Private _widgetFactories

_widgetFactories: {} = Object.create(null)

Type declaration

Private _widgetFactoriesForFileType

_widgetFactoriesForFileType: {} = Object.create(null)

Type declaration

  • [key: string]: string[]

Static defaultFileTypes

defaultFileTypes: ReadonlyArray<Partial<IFileType>> = [defaultTextFileType,defaultNotebookFileType,defaultDirectoryFileType,{name: 'markdown',displayName: 'Markdown File',extensions: ['.md'],mimeTypes: ['text/markdown'],icon: markdownIcon},{name: 'python',displayName: 'Python File',extensions: ['.py'],mimeTypes: ['text/x-python'],icon: pythonIcon},{name: 'json',displayName: 'JSON File',extensions: ['.json'],mimeTypes: ['application/json'],icon: jsonIcon},{name: 'csv',displayName: 'CSV File',extensions: ['.csv'],mimeTypes: ['text/csv'],icon: spreadsheetIcon},{name: 'tsv',displayName: 'TSV File',extensions: ['.tsv'],mimeTypes: ['text/csv'],icon: spreadsheetIcon},{name: 'r',displayName: 'R File',mimeTypes: ['text/x-rsrc'],extensions: ['.r'],icon: rKernelIcon},{name: 'yaml',displayName: 'YAML File',mimeTypes: ['text/x-yaml', 'text/yaml'],extensions: ['.yaml', '.yml'],icon: yamlIcon},{name: 'svg',displayName: 'Image',mimeTypes: ['image/svg+xml'],extensions: ['.svg'],icon: imageIcon,fileFormat: 'base64'},{name: 'tiff',displayName: 'Image',mimeTypes: ['image/tiff'],extensions: ['.tif', '.tiff'],icon: imageIcon,fileFormat: 'base64'},{name: 'jpeg',displayName: 'Image',mimeTypes: ['image/jpeg'],extensions: ['.jpg', '.jpeg'],icon: imageIcon,fileFormat: 'base64'},{name: 'gif',displayName: 'Image',mimeTypes: ['image/gif'],extensions: ['.gif'],icon: imageIcon,fileFormat: 'base64'},{name: 'png',displayName: 'Image',mimeTypes: ['image/png'],extensions: ['.png'],icon: imageIcon,fileFormat: 'base64'},{name: 'bmp',displayName: 'Image',mimeTypes: ['image/bmp'],extensions: ['.bmp'],icon: imageIcon,fileFormat: 'base64'}]

The default file types used by the document registry.

Accessors

changed

isDisposed

  • get isDisposed(): boolean

Methods

addFileType

  • addFileType(fileType: Partial<IFileType>): IDisposable
  • Add a file type to the document registry.

    params

    fileType - The file type object to register.

    Parameters

    Returns IDisposable

    A disposable which will unregister the command.

    Notes

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

addModelFactory

  • Add a model factory to the registry.

    Parameters

    Returns IDisposable

    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.

addWidgetExtension

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

    Parameters

    • widgetName: string

      The name of the widget factory.

    • extension: WidgetExtension

      A widget extension.

    Returns IDisposable

    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.

addWidgetFactory

  • Add a widget factory to the registry.

    Parameters

    Returns IDisposable

    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'.

defaultRenderedWidgetFactory

  • Get the default rendered widget factory for a path.

    Parameters

    • path: string

      The path to for which to find a widget factory.

    Returns WidgetFactory

    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.

defaultWidgetFactory

dispose

  • dispose(): void

fileTypes

getFileType

  • getFileType(name: string): IFileType | undefined

getFileTypeForModel

getFileTypesForPath

  • getFileTypesForPath(path: string): IFileType[]

getKernelPreference

getModelFactory

getWidgetFactory

  • getWidgetFactory(widgetName: string): WidgetFactory | undefined

modelFactories

preferredWidgetFactories

  • Get a list of the preferred widget factories.

    Parameters

    • path: string

      The file path to filter the results.

    Returns WidgetFactory[]

    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

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.

    Parameters

    • fileType: string
    • factory: string | undefined

    Returns void

widgetExtensions

widgetFactories

Object literals

Static defaultDirectoryFileType

defaultDirectoryFileType: object

The default directory file type used by the document registry.

contentType

contentType: "directory" = "directory"

extensions

extensions: never[] = []

icon

icon: LabIcon = folderIcon

mimeTypes

mimeTypes: string[] = ['text/directory']

name

name: string = "directory"

Static defaultNotebookFileType

defaultNotebookFileType: object

The default notebook file type used by the document registry.

contentType

contentType: "notebook" = "notebook"

displayName

displayName: string = "Notebook"

extensions

extensions: string[] = ['.ipynb']

fileFormat

fileFormat: "json" = "json"

icon

icon: LabIcon = notebookIcon

mimeTypes

mimeTypes: string[] = ['application/x-ipynb+json']

name

name: string = "notebook"

Static defaultTextFileType

defaultTextFileType: object

The default text file type used by the document registry.

extensions

extensions: string[] = ['.txt']

icon

icon: LabIcon = fileIcon

mimeTypes

mimeTypes: string[] = ['text/plain']

name

name: string = "text"

Static fileTypeDefaults

fileTypeDefaults: object

The defaults used for a file type.

contentType

contentType: "file" = "file"

extensions

extensions: never[] = []

fileFormat

fileFormat: "text" = "text"

mimeTypes

mimeTypes: never[] = []

name

name: string = "default"

Generated using TypeDoc