HtmlDecorationTemplate

data class HtmlDecorationTemplate(val layout: HtmlDecorationTemplate.Layout, val width: HtmlDecorationTemplate.Width = Width.WRAP, val element: (Decoration) -> String = { "<div/>" }, val stylesheet: String? = null) : JSONable

An HtmlDecorationTemplate renders a Decoration into a set of HTML elements and associated stylesheet.

Parameters

layout

Determines the number of created HTML elements and their position relative to the matching DOM range.

width

Indicates how the width of each created HTML element expands in the viewport.

element

Closure used to generate a new HTML element for the given Decoration. Several elements will be created for a single decoration when using the BOXES layout. The Navigator will automatically position the created elements according to the decoration's Locator. The template is only responsible for the look and feel of the generated elements. Every child elements with a data-activable="1" HTML attribute will handle tap events. If no element has this attribute, the root element will handle taps.

stylesheet

A CSS stylesheet which will be injected in the resource, which can be referenced by the created elements. Make sure to use unique identifiers for your classes and IDs to avoid conflicts with the HTML resource itself. Best practice is to prefix with your app name. r2- and readium- are reserved by the Readium toolkit.

Constructors

Link copied to clipboard
constructor(layout: HtmlDecorationTemplate.Layout, width: HtmlDecorationTemplate.Width = Width.WRAP, element: (Decoration) -> String = { "<div/>" }, stylesheet: String? = null)

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Determines the number of created HTML elements and their position relative to the matching DOM range.

Link copied to clipboard

Indicates how the width of each created HTML element expands in the viewport.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open override fun toJSON(): JSONObject