WeaveCopyPasteNodesPlugin
Activate support to copy & paste the nodes
Overview
The WeaveCopyPasteNodesPlugin class that enables copying and pasting nodes within the collaborative canvas environment.
It provides users with familiar keyboard shortcuts:
This plugin improves productivity and usability, especially in complex design, diagramming, or whiteboard-style applications.
The class extends the WeavePlugin class
Name
This plugin name
property value is copyPasteNodes
.
Import
import { WeaveCopyPasteNodesPlugin } from "@inditextech/weave-sdk";
Instantiation
new WeaveCopyPasteNodesPlugin();
TypeScript types
type WeaveCopyPasteNodesPluginOnCopyEvent = Error | undefined;
type WeaveCopyPasteNodesPluginOnPasteEvent = Error | undefined;
type WeaveCopyPasteNodesPluginOnPasteExternalEvent = ClipboardItem;
type WeavePasteModel = {
weaveInstanceId: string;
weave: Record<string, WeaveStateElement>;
weaveMinPoint: Vector2d;
};
type WeaveToPasteNode = {
konvaNode: Konva.Node;
node: NodeSerializable;
};
Methods
copy
async copy(): void
This method copy the selected nodes to the clipboard.
paste
paste(): void
This method paste onto the stage the contents of the clipboard ir are supported by Weave.js.
Events
onCopy
onCopy: WeaveCopyPasteNodesPluginOnCopyEvent;
The onCopy
event is called when an user triggered a copy action and the copy finished.
onPaste
onPaste: WeaveCopyPasteNodesPluginOnPasteEvent;
The onPaste
event is called when an user triggered a paste action and the paste finished.
onPasteExternal
onPasteExternal: WeaveCopyPasteNodesPluginOnPasteExternalEvent;
The onPasteExternal
event is called when an user triggers a paste action from elements
external to the actual tab of the browser.