@theia/core
Version:
Theia is a cloud & desktop IDE framework implemented in TypeScript.
26 lines • 1.48 kB
TypeScript
import { Disposable } from '../../common';
import { MarkdownString } from '../../common/markdown-rendering/markdown-string';
import { OpenerService } from '../opener-service';
/**
* Marks an element whose markdown links are already routed through an {@link OpenerService}.
*
* Renderers that install their own link handling declare it with {@link markMarkdownLinksWired},
* so that {@link wireMarkdownLinkHandler} does not add a second handler and open every link twice.
*/
export declare const MARKDOWN_LINKS_WIRED_ATTRIBUTE = "data-theia-markdown-links-wired";
/** Declares that the element's markdown links are already routed through an {@link OpenerService}. */
export declare function markMarkdownLinksWired(root: HTMLElement): void;
/**
* Wires up anchor clicks inside a rendered markdown element so that they are routed
* through the {@link OpenerService} instead of relying on default browser navigation.
* Honors {@link MarkdownString.isTrusted} for `command:` URIs.
*
* Also sets the `title` attribute on each anchor to its `href` (when no title is set)
* so users can hover to see the link target.
*
* Does nothing if the element's links are already wired, see {@link markMarkdownLinksWired}.
*
* @returns a {@link Disposable} that removes the click listener.
*/
export declare function wireMarkdownLinkHandler(root: HTMLElement, source: MarkdownString, openerService: OpenerService): Disposable;
//# sourceMappingURL=markdown-link-handler.d.ts.map