Options
All
  • Public
  • Public/Protected
  • All
Menu

An object which manages mime renderer factories. The namespace for RenderMimeRegistry class statics.

This object is used to render mime models using registered mime renderers, selecting the preferred mime renderer to render the model into a widget.

Notes

This class is not intended to be subclassed.

Hierarchy

  • RenderMimeRegistry

Implements

Index

Constructors

constructor

Properties

Private _factories

_factories: Private.FactoryMap

Private _id

_id: number = 0

Private _ranks

_ranks: Private.RankMap

Private _types

_types: string[] | null = null

latexTypesetter

latexTypesetter: ILatexTypesetter | null

The LaTeX typesetter for the rendermime.

linkHandler

linkHandler: ILinkHandler | null

The object used to handle path opening links.

resolver

resolver: IResolver | null

The object used to resolve relative urls for the rendermime instance.

sanitizer

sanitizer: ISanitizer

The sanitizer used by the rendermime instance.

Accessors

mimeTypes

  • get mimeTypes(): ReadonlyArray<string>

Methods

addFactory

  • Add a renderer factory to the rendermime.

    Parameters

    • factory: IRendererFactory

      The renderer factory of interest.

    • Optional rank: undefined | number

      The rank of the renderer. A lower rank indicates a higher priority for rendering. If not given, the rank will defer to the defaultRank of the factory. If no defaultRank is given, it will default to 100.

      Notes

      The renderer will replace an existing renderer for the given mimeType.

    Returns void

clone

createModel

createRenderer

  • createRenderer(mimeType: string): IRenderer
  • Create a renderer for a mime type.

    throws

    An error if no factory exists for the mime type.

    Parameters

    • mimeType: string

      The mime type of interest.

    Returns IRenderer

    A new renderer for the given mime type.

getFactory

getRank

  • getRank(mimeType: string): number | undefined
  • Get the rank for a given mime type.

    Parameters

    • mimeType: string

      The mime type of interest.

    Returns number | undefined

    The rank of the mime type or undefined.

preferredMimeType

  • preferredMimeType(bundle: ReadonlyPartialJSONObject, safe?: "ensure" | "prefer" | "any"): string | undefined
  • Find the preferred mime type for a mime bundle.

    Parameters

    • bundle: ReadonlyPartialJSONObject

      The bundle of mime data.

    • Default value safe: "ensure" | "prefer" | "any" = "ensure"

      How to consider safe/unsafe factories. If 'ensure', it will only consider safe factories. If 'any', any factory will be considered. If 'prefer', unsafe factories will be considered, but only after the safe options have been exhausted.

    Returns string | undefined

    The preferred mime type from the available factories, or undefined if the mime type cannot be rendered.

removeMimeType

  • removeMimeType(mimeType: string): void

setRank

  • setRank(mimeType: string, rank: number): void
  • Set the rank of a given mime type.

    Parameters

    • mimeType: string

      The mime type of interest.

    • rank: number

      The new rank to assign.

      Notes

      This is a no-op if the mime type is not registered.

    Returns void

Generated using TypeDoc