This interface can be used to customize the clipboard behavior for individual IModelItems.
Remarks
Examples
const nodeDecorator = graph.decorator.nodes
// Set a custom IClipboardHelper for all nodes in the graph
nodeDecorator.clipboardHelper.addConstant(new MyClipboardHelper())
Related Programming Samples
- Clipboard
- Shows different ways of using the class GraphClipboard for Copy & Paste operations.
Type Details
- yFiles module
- view
Methods
This method is called during the copy operation of the given item.
Remarks
If the source graph is a managed folding view, the item
is always a master item.
This instance is retained and reused during the paste operation. As a result, you can maintain state on the instance and retrieve it in a subsequent invocation of onPasted.
Parameters
A map of options to pass to the method.
- context - IGraphClipboardContext
- The context in which this interface is used.
- item - IModelItem
- The item to copy to the clipboard.
This method is called during the cut operation of the given item.
Remarks
If the source graph is a managed folding view, the item
is always a master item.
This instance is retained and reused during the paste operation. As a result, you can maintain state on the instance and retrieve it in a subsequent invocation of onPasted.
Parameters
A map of options to pass to the method.
- context - IGraphClipboardContext
- The context in which this interface is used.
- item - IModelItem
- The item to cut to the clipboard.
This method is called after the item has been duplicated in the graph.
Remarks
original
and duplicate
are master items.Parameters
A map of options to pass to the method.
- context - IGraphClipboardContext
- The context in which this interface is used.
- original - IModelItem
- The original item which is duplicated.
- duplicate - IModelItem
- The duplicate of the original item.
This method is called after the item has been pasted from the clipboard.
Remarks
The item
is always a master item since the clipboard graph is not a managed folding view.
The instance which has been retrieved during onCopied or onCut for the original item is retained and re-used here. This allows the developer to store state in these calls and then retrieve it here to modify the pasted item.
Parameters
A map of options to pass to the method.
- context - IGraphClipboardContext
- The context in which this interface is used.
- item - IModelItem
- The item that has been created during the paste operation.
Determines whether the given item can or should be copied to the clipboard.
Remarks
item
is always a view item.Parameters
A map of options to pass to the method.
- context - IGraphClipboardContext
- The context in which this interface is used.
- item - IModelItem
- The item in question.
Returns
- ↪boolean
- Whether this item should be copied.
Determines whether the given item can or should be cut to the clipboard.
Remarks
item
is always a view item.Parameters
A map of options to pass to the method.
- context - IGraphClipboardContext
- The context in which this interface is used.
- item - IModelItem
- The item in question.
Returns
- ↪boolean
- Whether this item should be cut.
Determines whether the given item can or should be duplicated in the source graph.
Remarks
item
is always a view item.Parameters
A map of options to pass to the method.
- context - IGraphClipboardContext
- The context in which this interface is used.
- item - IModelItem
- The item in the source graph.
Returns
- ↪boolean
- Whether this item should be duplicated.
Determines whether the given item can or should be pasted from the clipboard to the target graph.
Remarks
item
is always a master item since the clipboard graph is not a managed folding view.Parameters
A map of options to pass to the method.
- context - IGraphClipboardContext
- The context in which this interface is used.
- item - IModelItem
- The item in the clipboard graph.
Returns
- ↪boolean
- Whether this item should be pasted.
Static Methods
Parameters
A map of options to pass to the method.
- shouldCopy - function(IGraphClipboardContext, IModelItem):boolean
Determines whether the given item can or should be copied to the clipboard.
This property holds the implementation for shouldCopy.
- shouldCut - function(IGraphClipboardContext, IModelItem):boolean
Determines whether the given item can or should be cut to the clipboard.
This property holds the implementation for shouldCut.
- shouldPaste - function(IGraphClipboardContext, IModelItem):boolean
Determines whether the given item can or should be pasted from the clipboard to the target graph.
This property holds the implementation for shouldPaste.
- shouldDuplicate - function(IGraphClipboardContext, IModelItem):boolean
Determines whether the given item can or should be duplicated in the source graph.
This property holds the implementation for shouldDuplicate.
- onCopied - function(IGraphClipboardContext, IModelItem):void
This method is called during the copy operation of the given item.
This property holds the implementation for onCopied.
- onCut - function(IGraphClipboardContext, IModelItem):void
This method is called during the cut operation of the given item.
This property holds the implementation for onCut.
- onPasted - function(IGraphClipboardContext, IModelItem):void
This method is called after the item has been pasted from the clipboard.
This property holds the implementation for onPasted.
- onDuplicated - function(IGraphClipboardContext, IModelItem, IModelItem):void
This method is called after the item has been duplicated in the graph.
This property holds the implementation for onDuplicated.