Class DocumentRegistry

The document registry.

Hierarchy

  • DocumentRegistry

Implements

Constructors

Properties

_changed: any
_defaultRenderedWidgetFactories: any
_defaultWidgetFactories: any
_defaultWidgetFactory: any
_defaultWidgetFactoryOverrides: any
_extenders: any
_fileTypes: any
_isDisposed: any
_modelFactories: any
_widgetFactories: any
_widgetFactoriesForFileType: any
translator: ITranslator

Accessors

  • get isDisposed(): boolean
  • Get whether the document registry has been disposed.

    Returns boolean

Methods

  • Add a file type to the document registry.

    Parameters

    Returns IDisposable

    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.

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

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

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

  • 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]].

    The user setting defaultViewers took precedence on this one too.

  • Get the default widget factory for a path.

    Parameters

    • Optional path: string

      An optional file path to filter the results.

    Returns WidgetFactory

    The default widget factory for an path.

    Notes

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

  • Dispose of the resources held by the document registry.

    Returns void

  • Create an iterator over the file types that have been registered.

    Returns IterableIterator<DocumentRegistry.IFileType>

    A new iterator of file types.

  • Get the file types that match a file name.

    Parameters

    • path: string

      The path of the file.

    Returns DocumentRegistry.IFileType[]

    An ordered list of matching file types.

  • Get a kernel preference.

    Parameters

    • path: string

      The file path.

    • widgetName: string

      The name of the widget factory.

    • Optional kernel: Partial<Kernel.IModel>

      An optional existing kernel model.

    Returns IKernelPreference

    A kernel preference.

  • Get a widget factory by name.

    Parameters

    • widgetName: string

      The name of the widget factory.

    Returns WidgetFactory

    A widget factory instance.

  • Create an iterator over the model factories that have been registered.

    Returns IterableIterator<DocumentRegistry.ModelFactory>

    A new iterator of model factories.

  • 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
  • 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

    Returns void

  • Create an iterator over the registered extensions for a given widget.

    Parameters

    • widgetName: string

      The name of the widget factory.

    Returns IterableIterator<WidgetExtension>

    A new iterator over the widget extensions.

  • Create an iterator over the widget factories that have been registered.

    Returns IterableIterator<WidgetFactory>

    A new iterator of widget factories.

Generated using TypeDoc