Nutrient Web SDK
    Preparing search index...

    Interface TextBlockSlotParams

    Per-block rendering state handed to the UI.ContentEditorSlots#textBlock slot. The SDK still owns gesture recognition, text input / IME, and layout — the slot owns the visual representation.

    The slot is invoked once per visible text block. Its render function returns a DOM node that the SDK positions as an overlay aligned to the block's bounding box. The customer can render decorations (a selection ring, custom handles, a styled caret) and use CSS to hide the bundled chrome they want to replace.

    interface TextBlockSlotParams {
        anchor: { x: number; y: number };
        boundingBox: { height: number; left: number; top: number; width: number };
        cursor: { height: number; x: number; y: number } | null;
        id: string;
        interactionState: "selected" | "idle" | "active" | "moving";
        isLocked: boolean;
        layout: { maxWidth: number | null };
        pageIndex: number;
        segments: readonly {
            bold: boolean;
            color: string;
            family: string | null;
            italic: boolean;
            size: number;
            text: string;
        }[];
        selection: { begin: number; end: number }
        | null;
        text: string;
        textBlockId: string;
    }
    Index

    Properties

    anchor: { x: number; y: number }

    Anchor in page coordinates.

    boundingBox: { height: number; left: number; top: number; width: number }

    Bounding box in page coordinates.

    cursor: { height: number; x: number; y: number } | null

    Cursor (insertion point). Present only when interactionState === "active" and the selection is collapsed.

    Type Declaration

    • { height: number; x: number; y: number }
      • height: number

        Caret height in page coordinates.

      • x: number

        Pixel x within the block (page coordinates, before zoom).

      • y: number

        Pixel y within the block (page coordinates, before zoom).

    • null
    id: string

    Opaque block identifier. Do not parse; use pageIndex / textBlockId for structured data.

    interactionState: "selected" | "idle" | "active" | "moving"

    Whether the block is idle, selected (clicked), active (editing), or being moved.

    isLocked: boolean
    layout: { maxWidth: number | null }

    Paragraph-level layout.

    pageIndex: number
    segments: readonly {
        bold: boolean;
        color: string;
        family: string | null;
        italic: boolean;
        size: number;
        text: string;
    }[]

    Text broken into runs of uniform style — what a renderer needs to draw mixed-styled content (e.g. half a sentence bold, half italic).

    selection: { begin: number; end: number } | null

    Text selection inside this block. Present only when interactionState === "active" and a non-empty range is selected.

    text: string

    Plain text content of the block.

    textBlockId: string