ContentBlock

interface ContentBlock

A Node within a content block tree.

The content block tree describes the structure and contents of a content document in JSON format.

Nodes that contain children must have blockClass set to CONTAINER. Nodes that are leaves must have blockClass set to TEXT or MEDIA.

Properties

Link copied to clipboard

An array representing all the node's attributes

Link copied to clipboard

Classification of the block. The value 'CONTAINER' implies that children must be set and that textContent is the empty string ''.

Link copied to clipboard

Further specifies the type of block within a block class.

Link copied to clipboard
abstract val children: List<ContentBlock>

Must be empty if blockClass is 'MEDIA' or 'TEXT'

Link copied to clipboard
abstract val id: Int

An id that is unique for the content block within the reader document.

Link copied to clipboard

Further describes parts of the textContent. Such as bold or italic text.

Link copied to clipboard

The ContentBlockTree instance this ContentBlock belongs to.

Link copied to clipboard
abstract var parent: ContentBlock?

The parent ContentBlock, or null if this ContentBlock has no parent.

Link copied to clipboard
abstract val resourceHrefs: List<String>?

Set if blockClass is "MEDIA". The hrefs may be relative or absolute. If relative, it must be resolved with a resource provider associated with the owner publication.

Link copied to clipboard
abstract val textContent: String

The text content of this block. Is always the empty string if blockClass is 'CONTAINER'. If blockClass is 'MEDIA' it represents the "title" of the media.

Functions

Link copied to clipboard
abstract suspend fun fetchLocator(charOffset: Int = 0, charLength: Int? = null): ColibrioResult<SimpleLocatorData>

Fetch a Locator for this ContentBlock.