API reference / Common / ExtensionDocument
Interface: ExtensionDocument
A kind of document the engine doesn't read — video, a web page — that the viewer and the editor open, view only. Register one with UDocOptions.extensionDocuments, or registerExtensionDocument later.
open asks the extension documents in turn before the engine: one whose formats holds the format it was given opens it; with no format given, the first whose canOpen says yes does. It renders into a <div> filling the document area, where the canvas hides.
Properties
| Property | Description |
|---|---|
readonly docTypestring | What kind of document it is, as "presentation" is one the engine opens: "media", say. docType reports it while one is open, and it names the extension document: registering one of a doc type already registered replaces that one. None of the engine's own doc types. |
readonly formatsreadonly string[] | The source formats it opens, as pptx and potx are a presentation's: "mp4", "hls", say. An OpenOptions.format among them picks it, with no canOpen asked, and its viewer's sourceFormat is one of them. |
Methods
canOpen()
canOpen(request): boolean | Promise<boolean>;Whether it opens what open was given, when open was given no format. Asked in the order the extension documents were registered; the first to say yes opens it, and with none the engine does. A rejection fails the open.
Parameters
| Parameter | Type |
|---|---|
request | ExtensionDocumentOpenRequest |
open()
open(
container,
request,
host
): Promise<ExtensionDocumentViewer>;Render what request names into container, a <div> filling the document area, resolving with its viewer once it shows. The loading overlay covers the area until then; a rejection fails the open, and the container is removed.
Parameters
| Parameter | Type |
|---|---|
container | HTMLDivElement |
request | ExtensionDocumentOpenRequest |
host | ExtensionDocumentHost |