How to get selectionManager?
import selectionManager from 'fontoxml-selection/src/selectionManager.js'
Manages the selection by exposing the selected range in various ways. The selection manager also tracks the ID of the document containing the selection (the "focused document"), as well as the hierarchy node ID corresponding to the view containing this selection. This last ID helps to disambiguate cases where the selection could be mapped to multiple views.
The focused document is updated automatically whenever an operation changes the selection. If this operation's StepData also contains a
hierarchyNodeId property, that hierarchy node becomes the new focused hierarchy node. This focused hierarchy node ID may be adjusted automatically if the selection is not mappable to the corresponding view and ends up in a different view instead.
Focused Document Notifier
Notifier which can be used to be notified when another document is focused.
Notifier which can be used to be notified when the selection changes.
Get a clone of the selection range. Remember to detach this range after use.
Consider using other methods on the SelectionManager instead.
Common Ancestor Container
Get the common ancestor of the selection in the focused document
Get the end container of the selection in the focused document
Get the end offset of the selection in the focused document
Focused Hierarchy Node
Returns the currently focused hierarchy node, or null if there is no selection.
Focused Hierarchy Node Id
Returns the ID of the current focused hierarchy node, or null if there is none.
If there is no selection, this may still return the ID of a focused placeholder.
Get the currently selected element, being the element fully contained in the selection, or the common ancestor of the selection.
Get the start container of the selection in the focused document
Get the start offset of the selection in the focused document
Test whether Fonto has a selection in any document
This is only false when there are zero document loaded
Get whether the selection in the focused document is collapsed