Copy, cut and paste like Excel (TableOptionsIf.clipboard): the copy, cut and paste events of the browser (synchronous, no permission prompt). The keys (Ctrl/⌘+C, X, V) focus a hidden text field for the moment of the key press, so that every browser – also Safari, which sends no clipboard events to a focused div – fires the event; the focus returns to the table right after it. The Edit menu of the browser works on the focused table, too. Created by TableScope: with the option (tableScope.clipboardService, keys and events), otherwise on demand for the API (TableApi.pasteText, TableApi.getSelectionAsText).

Since

1.1.99

Hierarchy

  • ClipboardService

Constructors

Properties

complete options

Methods

  • Ctrl/⌘+C, X or V (from the shortcut mapping): focuses the hidden text field so that the browser fires its clipboard event there. The key must not be consumed (preventDefault) – the caller returns false.

    Parameters

    Returns boolean

    true if the event will be handled; false: not here (the editor is open, header focus, an own CopyServiceIf for copying)

  • Pastes text (see TableApi.pasteText): parsed like the clipboard, from target or the selection.

    Parameters

    • text: string

      tab-separated text

    • Optional html: string

      text/html (used only without text)

    • Optional target: [number, number]

      display row and model column of the first cell (no tiling)

    Returns CellChangeIf<any>[]

    the written (batch edit: newly pending) cells

  • Copies (or cuts) the selected cells with the asynchronous clipboard API (text/plain and text/html with ClipboardItem, otherwise writeText) – for buttons and menus (see TableApi.copySelection).

    Parameters

    • cut: boolean

      true: mark the cells, they move on the next paste

    Returns Promise<void>

    resolves when the clipboard was written