Options
All
  • Public
  • Public/Protected
  • All
Menu

Locator instances are used for referencing specific locations (including ranges) in publications.

The Locator type is modeled after and compatible with the "External Web Resource" and "Specific Resource" types defined by the Web Annotations specification: https://www.w3.org/TR/annotation-model

Locator can be serialized into various formats such as:

  • IWebAnnotationResourceData - modeling the Web annotation "External Web Resource" type.
  • IWebAnnotationSpecificResourceData - modeling the Web annotation "Specific Resource" type.
  • URL - (non-fragment selectors are serialized according to the Selectors and States Note: https://www.w3.org/TR/selectors-states/

Legacy Colibrio IAnnotationTarget objects are not valid with the "External Web Resource" or "Specific Resource" types due to using "id" instead of "source" while also specifying a "selector". For backwards compatibility, these object can still be parsed into Locators.

NOTE: JSON-LD processing is NOT supported. Ensure that the data used to instantiate Locators follows the recommended serialization format specified in https://www.w3.org/TR/annotation-vocab/#json-ld-context

Hierarchy

  • ILocator

Implemented by

Index

Methods

getSelectors

  • Get the Selectors for this Locator. Multiple Selectors should select the same content, however some Selectors will not have the same precision as others. The first selector in the array has the highest precision.

    Returns ISelector[]

getSourceUrl

  • getSourceUrl(): string
  • Returns the URL of the Locator without the hash fragment part if any. This can be a http URL, an isbn identifier (isbn:4636...) or any other URL, URI, IRI, URN identifier

    Returns string

toJSON

  • Returns this locator as a JSON serializable object. Use LocatorFactory.parse() to deserialize this data back to a Locator.

    Returns ISimpleLocatorData

toLegacyAnnotationTarget

  • Method used to convert a locator to a ILegacyAnnotationTarget that is compatible with older versions of the Colibrio framework. Note that the format and type fields will not be set, so if you need them, you have to set them manually.

    Returns ILegacyAnnotationTargetData

toString

  • toString(): string
  • Get this Locator as an URL string.

    Returns string

toUrl

  • toUrl(): URL
  • Get this Locator as an URL.

    Returns URL

toWebAnnotationResource

  • Returns this Locator as an External Web Resource as described by the Web Annotation Data Model. See IWebAnnotationResourceData for more information.

    Returns IWebAnnotationResourceData

toWebAnnotationSpecificResource

  • Returns this Locator as a Specific Resource described by the Web Annotation Data Model. See IWebAnnotationSpecificResourceData for more information.

    Returns IWebAnnotationSpecificResourceData

Generated using TypeDoc