If this ContentLocation represents a range, it creates a new ContentLocation by collapsing to its end position. If this ContentLocation does not represent a range, the instance itself is returned.
If this ContentLocation represents a range, it creates a new ContentLocation by collapsing to its start position. If this ContentLocation does not represent a range, the instance itself is returned.
Check if the passed ContentLocation is equal to this one, or is contained inside this ContentLocation.
Creates a new ContentLocation representing the range from the start of this instance to the end of endLocation.
Check if this ContentLocation target exactly the same content as the passed ContentLocation.
Fetch the content blocks that corresponds to the ContentLocation.
Determines whether it should include the ContentBlock before or after the location if the ContentLocation start or end, targets content in between two ContentBlocks.
Fetch a IContentLocationContentResolver for the ContentLocation. The IContentLocationContentResolver is used for getting publication content related with this ContentLocation.
Fetch references to the ReaderPublicationNavigationItems related with this ContentLocation. This can for example be used to get the current "Table of Contents" items that are currently visible in the ReaderView.
Example:
readerView.getReadingPosition().fetchNavigationItemReferences({
collectionTypes: [NavigationCollectionType.TOC], // Only fetch items from the "Table of contents" collection.
greedy: true, // For TOC, specify `greedy: true`, see IFetchNavigationItemReferencesOptions for more information.
})
Get the Locator that was used to create this instance.
Get the ReaderDocuments that this ContentLocation points to.
Get the ReaderPublication associated with this instance.
Check if this ContentLocation intersects with another ContentLocation.
Check if this ContentLocation is strictly after the passed ContentLocation. Returns false if the locations are intersecting.
Check if this ContentLocation is strictly before the passed ContentLocation. Returns false if the locations are intersecting.
Returns true if this ContentLocation represents a range.
Return a serializable version of the Locator that was used to create this instance.
This is the same as calling getLocator().toJSON()
.
Generated using TypeDoc
Represents a location within a ReaderPublication and methods to extract information related to that location. A ContentLocation can be a position in the publication content, or a range across publication content.
ContentLocations are provided by all APIs in the framework that reference positions and ranges within ReaderPublications. Some example of APIs that provide ContentLocations are:
In contrast to UnresolvedContentLocation, a ContentLocation knows its position within the publication content and can thereby be used to compare and sort ContentLocation instances synchronously. The following methods are synchronous in ContentLocation but not in UnresolvedContentLocation:
If you only need to get the ReaderDocument for a Locator, ReaderPublication.fetchUnresolvedContentLocation() should be preferred as it is more performant than ReaderPublication.fetchContentLocation().