DocumentsManager

Type: Class

How to get documentsManager?

JavaScript

import documentsManager from 'fontoxml-documents/src/documentsManager.js'

The documents manager manages the set of loaded documents.

Properties

documentsCollectionChangedNotifier

Type: Notifier

Notifier that can be used to be notified the set of loaded documents has changed.

Methods

addDocumentChangeCallback

Type: Function

Registers callback to be invoked whenever any change is made to the XML of the document with ID documentId. If you're interested in specific nodes, consider using an index instead.

Returns a function which can be called to remove the callback.

Arguments

Returns

addDocumentMetadataChangeCallback

Type: Function

Get the metadata on a document. This is the metadata associated to the document by the cms when the document was loaded.

Arguments

Returns

addDocumentsCollectionChangedCallback

Type: Function

Registers callback to be invoked whenever the set of documents with the specified aspects changes. Usually, requiredAspects is set to either { 'cap/operable': true } to obtain all documents loaded in the content view, or to { 'cap/editable': true } for documents that are editable.

Returns a function which can be called to remove the callback.

Use the DocumentsManager#documentsCollectionChangeNotifier directly if you don't need to filter on aspects.

Arguments

Returns

documentMeetsRequiredAspects

Type: Function

Returns whether the document with the given documentId has the aspects specified by requiredAspects. Usually, requiredAspects is set to either { 'cap/operable': true } to check for documents loaded in the content view, or to { 'cap/editable': true } for documents that are editable.

Arguments

Returns

getAllDocumentIds

Type: Function

Returns the documentIds of all loaded documents. If requiredAspects is specified, only documents matching these aspects are returned.

Arguments

Returns

getDocumentIdByNodeId

Type: Function

Returns the documentId of the document containing the node with the given nodeId.

Arguments

Returns

getDocumentIdByRemoteDocumentId

Type: Function

Returns the documentId of the document specified by the given remote (i.e., CMS) document identifier, or null if the specified document is not currently loaded.

Arguments

Returns

getDocumentMetadata

Type: Function

Get the metadata on a document. This is the metadata associated to the document by the cms when the document was loaded. This will be null if the cms did not provide any metadata.

Arguments

Returns

getDocumentNode

Type: Function

Returns the document node for the document with the given documentId, or null if the specified document is not loaded.

Arguments

Returns

getNodeById

Type: Function

Returns the node with the given nodeId.

Arguments

Returns

getRemoteDocumentId

Type: Function

Get the remote document ID associated with the given document, or null if there is no loaded document with the given ID.

Arguments

Returns

hasDocument

Type: Function

Returns whether the document with the given documentId is still loaded.

Arguments

Returns

removeAllDocuments

Type: Function

Remove all documents. This should only be used to implement unloadAllDocuments.

Related links

removeDocument

Type: Function

Remove a document. Callers should make sure this document is not referenced anymore before calling this method.

Arguments

setDocumentError

Type: Function

Places the document in an error state, unloading it as a result.

Should only be called when an error is unrecoverable for the document.

Related links

Arguments

setDocumentMetadata

Type: Function

Set the metadata of a document. This is the metadata associated to the document by the cms when the document was loaded. Setting this metadata may trigger a save.

Arguments