ComPDFKit Web SDK
    Preparing search index...

    Class ContentBoxEditor

    Editor of a text content box: handles caret, selection, typing and deleting while the box is being edited.

    Index
    • Ends editing.

      Returns Promise<void>

    • Deletes backward (Backspace): deletes the selection if any, otherwise the character before the caret (like type, the caret is read when its turn comes).

      Returns Promise<void>

    • Deletes forward (Delete) (like type, the caret is read when its turn comes).

      Returns Promise<void>

    • The selected range (character indexes, one \n between paragraphs); both are the caret position when nothing is selected.

      Returns { endIndex: number; startIndex: number }

      • endIndex: number

        Index after the last selected character.

      • startIndex: number

        Index of the first selected character.

    • The current full text (one \n between paragraphs).

      Returns string

    • Attributes of the selected text (the whole box when nothing is selected), same as ContentEdit.loadTextAttributes.

      Returns Promise<TextAttributes>

    • Adds a link to the selected text: places a link annotation opening url over the selection bounds (SetLinkUri) and returns it; throws when no text is selected.

      Parameters

      • url: string

      Returns Promise<Core.Annotations.Annotation>

    • Opens the link address (in a new window).

      Parameters

      • url: string

      Returns void

    • Select the native paragraph at an unrotated page point (pt), after queued edits.

      Parameters

      • x: number
      • y: number

      Returns Promise<void>

    • Sets the selection (end defaults to the caret position); the caret is at end.

      Parameters

      • start: number
      • Optionalend: number

      Returns Promise<void>

    • Inserts at the caret (replacing the selection if any). The caret / selection is read when this operation's turn comes (not at call time): calling repeatedly without waiting (a script sending type('H'), type('e')...) still applies in call order.

      Parameters

      • text: string

      Returns Promise<void>

    The box being edited.