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

contains

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

    Parameters

    Returns boolean

equals

  • If this instance equals another content block

    Parameters

    Returns boolean

getAttributes

  • An array representing all the node's attributes

    Returns IAttributeData[]

getBlockClass

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

    Returns ContentBlockClass

getBlockType

getChildren

getContentBlockTree

getContentLocation

  • 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

  • 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

  • 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

  • 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

getMarks

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

    Returns IContentBlockMarkData[]

getNextSibling

  • Get the next content block sibling if any.

    Returns IContentBlock

getParent

getPreviousSibling

  • Get the previous content block sibling if any.

    Returns IContentBlock

getResourceHrefs

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

    Returns string[]

getTextContent

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

    Returns string

isAfter

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

    Parameters

    Returns boolean

isBefore

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

    Parameters

    Returns boolean

isLeaf

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

    Returns boolean

toSerializableData

Generated using TypeDoc