Theia API Documentation v1.65.0
    Preparing search index...

    A PreviewHandler manages the integration of one or more previews.

    It indicates whether a preview shall be rendered for a given resource URI and, if yes, renders the content. Additionally it optionally provides methods with which the scroll state of the preview and corresponding editor can be managed.

    See MarkdownPreviewHandler for an example implementation.

    Implements

    Index

    Constructors

    Properties

    contentClass: string = 'markdown-preview'
    engine: undefined | MarkdownIt
    iconClass: string = 'markdown-icon file-icon'

    One or more classes which specify the preview widget icon.

    linkNormalizer: PreviewLinkNormalizer
    openerService: OpenerService

    Methods

    • Indicates whether and with which priority (larger is better) this preview handler is responsible for the resource identified by the given URI. If multiple handlers return the same priority it's undefined which one will be used.

      Parameters

      • uri: URI

        the URI identifying a resource.

      Returns number

      a number larger than 0 if the handler is applicable, 0 or a negative number otherwise.

    • Search and return the HTMLElement which corresponds to the given fragment. This is used to initially reveal elements identified via the URI fragment.

      Parameters

      • content: HTMLElement

        the preview widget element containing the content previously rendered by PreviewHandler.renderContent.

      • link: string

        the URI fragment for which the corresponding element shall be returned

      Returns undefined | HTMLElement

      the HTMLElement which is part of content and corresponds to the given fragment, undefined otherwise.

    • Search and return the HTMLElement which corresponds to the given line number. This is used to scroll the preview when the source editor scrolls.

      Parameters

      • content: HTMLElement

        the preview widget element containing the previously rendered by PreviewHandler.renderContent.

      • sourceLine: number

        the line number for which the corresponding element shall be returned.

      Returns undefined | HTMLElement

      the HTMLElement which is part of content and corresponds to the given line number, undefined otherwise.

    • Returns the line number which corresponds to the preview element at the given offset. This is used to scroll the source editor when the preview scrolls.

      Parameters

      • content: HTMLElement

        the preview widget element containing the previously rendered by PreviewHandler.renderContent.

      • offset: number

        the total amount by which the preview widget is scrolled.

      Returns undefined | number

      the source line number which corresponds to the preview element at the given offset, undefined otherwise.