react-pdf-highlighter-plus

Interface FreetextHighlightProps

The props type for FreetextHighlight.

interface FreetextHighlightProps {
    backgroundColor?: string;
    backgroundColorPresets?: string[];
    bounds?: string | Element;
    color?: string;
    deleteIcon?: ReactNode;
    dragIcon?: ReactNode;
    editIcon?: ReactNode;
    fontFamily?: string;
    fontSize?: string;
    highlight: ViewportHighlight;
    isScrolledTo?: boolean;
    style?: CSSProperties;
    styleIcon?: ReactNode;
    textColorPresets?: string[];
    onChange?(rect): void;
    onContextMenu?(event): void;
    onDelete?(): void;
    onEditEnd?(): void;
    onEditStart?(): void;
    onStyleChange?(style): void;
    onTextChange?(text): void;
}

Properties

backgroundColor?: string

Background color.

backgroundColorPresets?: string[]

Custom background color presets for the style panel. Default: ["#ffffc8", "#ffcdd2", "#c8e6c9", "#bbdefb", "#e1bee7"]

bounds?: string | Element

react-rnd bounds on the highlight area.

color?: string

Text color.

deleteIcon?: ReactNode

Custom delete icon. Replaces the default trash icon.

dragIcon?: ReactNode

Custom drag icon. Receives default icon as child if not provided.

editIcon?: ReactNode

Custom edit icon. Receives default icon as child if not provided.

fontFamily?: string

Font family.

fontSize?: string

Font size (e.g., "14px").

The highlight to be rendered as a FreetextHighlight.

isScrolledTo?: boolean

Has the highlight been auto-scrolled into view?

style?: CSSProperties

Custom styling for the container.

styleIcon?: ReactNode

Custom style/settings icon. Receives default icon as child if not provided.

textColorPresets?: string[]

Custom text color presets for the style panel. Default: ["#333333", "#d32f2f", "#1976d2", "#388e3c", "#7b1fa2"]

Methods

  • A callback triggered on context menu.

    Parameters

    • event: MouseEvent<HTMLDivElement, MouseEvent>

    Returns void

  • A callback triggered whenever the text content changes.

    Parameters

    • text: string

      The new text content.

    Returns void