Clipboard Json
ClipboardJsonPlugin
The ClipboardJsonPlugin
is a custom plugin for the RevoGrid framework that enhances the clipboard
functionality by enabling JSON data parsing during copy and paste operations. This plugin allows
complex data structures to be serialized and deserialized correctly when copying to or pasting from
the clipboard, supporting advanced data handling scenarios within the grid.
Features:
- Intercepts the
CLIPBOARD_COPY_EVENT
to serialize objects in the grid cells into JSON strings prefixed with a special marker ($rv-parse_
). This ensures that complex data types are preserved during copy operations. - Intercepts the
CLIPBOARD_PASTE_EVENT
to deserialize JSON strings back into objects when pasted into the grid, restoring the original data structure. - Provides methods
parserCopy
andparserPaste
to handle the conversion logic, allowing for easy customization and extension.
Usage:
- Integrate
ClipboardJsonPlugin
into a RevoGrid instance to enable JSON data support in clipboard operations. This is particularly useful for applications that handle structured data or require seamless data interchange with external systems.
Example
import { ClipboardJsonPlugin } from '@revolist/revogrid-pro'
const grid = document.createElement('revo-grid');grid.plugins = [ClipboardJsonPlugin];
This plugin is essential for developers looking to enhance the data exchange capabilities of RevoGrid, providing robust support for copying and pasting complex data structures.
class ClipboardJsonPlugin { parserPaste(data: DataFormat[][]);
parserCopy(data: DataFormat[][]);}