blockly > clipboard

clipboard namespace

Classes

Class Description
BlockPaster

Functions

Function Description
copy(toCopy, location)

Copy a copyable item, and record its data and the workspace it was copied from.

This function does not perform any checks to ensure the copy should be allowed, e.g. to ensure the block is deletable. Such checks should be done before calling this function.

Note that if the copyable item is not an ISelectable or its workspace property is not a WorkspaceSvg, the copy will be successful, but there will be no saved workspace data. This will impact the ability to paste the data unless you explictily pass a workspace into the paste method.

getLastCopiedData() Gets the copy data for the last item copied. This is useful if you are implementing custom copy/paste behavior. If you want the default behavior, just use the copy and paste methods directly.
getLastCopiedLocation() Gets the location that was last copied from. This is useful if you are implementing custom copy/paste behavior. If you want the default behavior, just use the copy and paste methods directly.
getLastCopiedWorkspace() Gets the workspace that was last copied from. This is useful if you are implementing custom copy/paste behavior and want to paste on the same workspace that was copied from. If you want the default behavior, just use the copy and paste methods directly.
paste(copyData, workspace, coordinate)

Paste a pasteable element into the given workspace.

This function does not perform any checks to ensure the paste is allowed, e.g. that the workspace is rendered or the block is pasteable. Such checks should be done before calling this function.

paste() Pastes the last copied ICopyable into the last copied-from workspace.
setLastCopiedData(copyData) Sets the last copied item. You should call this method if you implement custom copy behavior, so that other callers are working with the correct data. This method is called automatically if you use the built-in copy method.
setLastCopiedLocation(location) Sets the location that was last copied from. You should call this method if you implement custom copy behavior, so that other callers are working with the correct data. This method is called automatically if you use the built-in copy method.
setLastCopiedWorkspace(workspace) Sets the workspace that was last copied from. You should call this method if you implement custom copy behavior, so that other callers are working with the correct data. This method is called automatically if you use the built-in copy method.

Interfaces

Interface Description
BlockCopyData

Namespaces

Namespace Description
registry