Class: Splits

Splits(chunker, polisher, caller)

Handles split content across paginated pages.

When content is split across pages (e.g., footnotes or paragraphs), this handler links the split parts together using data attributes (data-split-from, data-split-to, etc.) to assist layout engines or post-processing logic.

Constructor

new Splits(chunker, polisher, caller)

Create a new Splits handler instance.

Create a new Splits handler instance.

Parameters:
Name Type Description
chunker Object

The chunker instance used for page breaking.

polisher Object

The polisher instance used for styling.

caller Object

The orchestrating object coordinating handlers.

Source:

Methods

afterPageLayout(pageElement, page, breakToken, chunker)

Called after the layout of each page is completed.

Called after the layout of each page is completed.

  • Detects elements on the current page that have been split from a previous page.
  • Finds the original element on the previous page and adds metadata to link them.
  • Applies alignment adjustments to the original element.
Parameters:
Name Type Description
pageElement HTMLElement

The root element of the current page.

page Object

Page metadata object.

breakToken Object | null

Information about the point where the content was split.

chunker Object

The chunker instance.

Source:

handleAlignment(node)

Adjusts alignment metadata for a split element to preserve proper justification.

Adjusts alignment metadata for a split element to preserve proper justification.

This ensures that the last line of split content aligns correctly, particularly when text-align is set to justify.

Parameters:
Name Type Description
node HTMLElement

The original DOM node that was split.

Source: