DocumentsManager
How to get DocumentsManager
ES2015+:
import DocumentsManager from 'fontoxml-documents/documentsManager'
ES5:
define([
'fontoxml-documents/documentsManager'
], function (
DocumentsManager
) {
});
Type: Class
The documents manager manages the set of loaded documents.
Properties
Name | Type | Description |
---|---|---|
documentsCollectionChangedNotifier | Notifier | Notifier that can be used to be notified the set of loaded documents has changed. |
Methods
Name | Description |
---|---|
addDocumentChangeCallback | 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. |
addDocumentMetadataChangeCallback | Get the metadata on a document. This is the metadata associated to the document by the cms when the document was loaded. |
addDocumentsCollectionChangedCallback | Registers callback to be invoked whenever the set of documents with the specified aspects changes. Usually, requiredAspects is set to either 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. |
documentMeetsRequiredAspects | Returns whether the document with the given documentId has the aspects specified by requiredAspects. Usually, requiredAspects is set to either |
getAllDocumentIds | Returns the documentIds of all loaded documents. If requiredAspects is specified, only documents matching these aspects are returned. |
getDocumentIdByNodeId | Returns the documentId of the document containing the node with the given nodeId. |
getDocumentIdByRemoteDocumentId | 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. |
getDocumentMetadata | Get the metadata on a document. This is the metadata associated to the document by the cms when the document was loaded. |
getDocumentNode | Returns the document node for the document with the given documentId, or null if the specified document is not loaded. |
getNodeById | Returns the node with the given nodeId. |
getRemoteDocumentId | Get the remote document ID associated with the given document, or null if there is no loaded document with the given ID. |
getSchemaExperience | Returns the schema experience for the document with the given documentId, or null if the specified document is not loaded. |
hasDocument | Returns whether the document with the given documentId is still loaded. |
removeAllDocuments | Remove all documents. This should only be used to implement unloadAllDocuments. |
removeDocument | Remove a document. Callers should make sure this document is not referenced anymore before calling this method. |
setDocumentError | Places the document in an error state, unloading it as a result. Should only be called when an error is unrecoverable for the document. |
setDocumentMetadata | 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. |