Hierarchy

  • CopyService

Implements

Constructors

Properties

columnSeparatorChar: string = '\t'
maxCopyCells: number = 1_000_000

Upper limit for the number of cells createContent copies (e.g. after Ctrl+A on a table with millions of rows). Larger selections are rejected instead of building a huge string and blocking the browser.

Example

CopyService.maxCopyCells = 5_000_000; // allow bigger copies
rowSeparatorChar: string = '\n'

Methods

  • Copy the provided content to the clipboard.

    Parameters

    • content: string

      The content to be copied.

    Returns Promise<void>

    A promise that resolves when the content has been successfully copied to the clipboard.

  • Returns the content to be copied based on the provided table model, selection model, and focus model.

    • Selection: the bounding box of all selected ranges, one line per row, cells separated by TAB; cells inside the box that are not selected become empty strings, hidden columns are left out.
    • Everything selected (SelectionModelIf.selectAll, ⌘/Ctrl+A): all displayed body rows × all columns.
    • No selection: the text of the focused cell.

    Parameters

    • tableModel: TableModelIf

      The table model for data retrieval.

    • selectionModel: SelectionModelIf

      The selection model to determine the selected range.

    • focusModel: FocusModelIf

      The focus model to determine the focused cell.

    Returns Promise<string>

    A promise that resolves to the copied content as a string.

    Throws

    Throws an error if neither selection nor focus is defined.