Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a single content block node in a document.

Note that implementations may create multiple objects representing the same logical content block. Therefore, do not use == or ===, instead use equals() to check if two content blocks are equal.

Hierarchy

Index

Methods

  • If the specified contentBlock is a descendant of this instance.

    Parameters

    Returns boolean

  • If this instance equals another content block

    Parameters

    Returns boolean

  • An array representing all the node's attributes

    Returns IAttributeData[]

  • Classification of the block. The value 'CONTAINER' implies that getChildren() can return items and that getTextContent() will return the empty string ''.

    Returns ContentBlockClass

  • Get a ContentLocation for the complete or partial content block.

    Parameters

    • Optional charOffset: number

      The character offset within the block's text content where the ContentLocation should start. Defaults to 0.

    • Optional charLength: number

      The number of characters to include. Defaults to end of textContent if omitted.

    Returns IContentLocation

  • getId(): number
  • Get the id of this content block within the tree. The id can be used to fetch this content block again.

    Note that the id is only unique within the reader document. Use getLocator() to get a UUID to this content block.

    Returns number

  • getLanguage(): string
  • Get the nearest specified lang metadata for the content block. It starts looking for lang metadata on the current node and then traverses up the node tree until it finally falls back to the manifest language metadata.

    Returns string

  • getLocator(charOffset?: number, charLength?: number): ILocator
  • Get a Locator for the complete or partial content block.

    Parameters

    • Optional charOffset: number

      The character offset within the block's text content where the ContentLocation should start. Defaults to 0.

    • Optional charLength: number

      The number of characters to include. Defaults to end of textContent if omitted.

    Returns ILocator

  • Get the ContentBlockMarkData items that further describes parts of the textContent, such as bold or italic text.

    Returns IContentBlockMarkData[]

  • Get the next content block sibling if any.

    Returns IContentBlock

  • Get the previous content block sibling if any.

    Returns IContentBlock

  • getResourceHrefs(): string[]
  • Get media resource urls if blockClass is MEDIA

    Returns string[]

  • getTextContent(): string
  • Get the text content for this content block. Does not include children.

    Returns string

  • Check if this instance is after another content block in document order.

    Parameters

    Returns boolean

  • Check if this instance is before another content block, in document order.

    Parameters

    Returns boolean

  • isLeaf(): boolean
  • If this content block is a leaf node in the content block tree.

    Returns boolean

Generated using TypeDoc