DocumentsHierarchy

Type: Class

How to get documentsHierarchy?

JavaScript

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

The DocumentsHierarchy represents the relationships between the documents loaded in the DocumentsManager. It is a tree of DocumentsHierarchyNodes, each of which optionally references a document which can be loaded. The DocumentsHierarchy itself is the root of the tree and can not reference a document.

Properties

children

The top-level hierarchy nodes referencing the documents directly loaded in the editor

hierarchyChangedNotifier

Notifier to use for signalling hierarchy changes. Note that this is not called by the hierarchy itself, but should be used by components that mutate the hierarchy. This way, mutations can be batched.

This notifier is debounced internally.

Methods

addChild

Type: Function

Append a child to this hierarchy node

Arguments

clear

Type: Function

Remove all children of the hierarchy

find

Type: Function

Traverses the documents hierarchy in depth-first order looking for a hierarchy node for which the given callback returns true.

Arguments

Returns

findAll

Type: Function

Find all hierarchy nodes (in hierarchy order) for which the given callback returns true.

Arguments

Returns

findAllVisibleHierarchyNodes

Type: Function

Find all visible hierarchy nodes, in hierarchy order.

Returns

findAllWithSameTarget

Type: Function

Get all hierarchy nodes (in hierarchy order) targeting same node with the context hierarchy node. The return always includes the context hierarchy node.

Arguments

Returns

findNextVisibleHierarchyNode

Type: Function

Find the visible hierarchy node following (or preceding) the given hierarchy node in hierarchy order.

Arguments

Returns

get

Type: Function

Get the current DocumentsHierarchyNode with the given ID, or null if there is no node with that ID in the current hierarchy.

Arguments

Returns

getFirstVisibleHierarchyNode

Type: Function

Find the first visible hierarchy node.

Returns

getLastVisibleHierarchyNode

Type: Function

Find the last visible hierarchy node.

Returns

removeChild

Type: Function

Remove a child from this hierarchy node

Arguments