@samatawy/diagrams
    Preparing search index...

    Class DiagramClipboard

    Helper class for managing clipboard operations in the diagram editor. It provides methods for copying and pasting nodes and styles, as well as checking the clipboard state. It handles serialization and deserialization of nodes and styles, ensuring that pasted elements are correctly integrated into the diagram. The class also manages the clipboard snapshot to maintain a consistent state across different operations. The owning diagram is responsible for rendering and dispatching events.

    Index

    Constructors

    Properties

    can_paste: boolean = false
    can_paste_styles: boolean = false

    Methods

    • Checks if the clipboard contains styles that can be pasted into selected nodes.

      Returns Promise<boolean>

      A promise that resolves to true if styles are available for pasting, false otherwise.

    • Copies the selected nodes to the clipboard in JSON format. The copied data includes all properties of the nodes, allowing for accurate reconstruction when pasted. After copying, the canPaste flag is set to true, indicating that there is data available in the clipboard that can be pasted into the diagram.

      Returns INode[]

      An array of the nodes that were copied to the clipboard.

    • Pastes nodes from the clipboard into the diagram.

      Returns Promise<INode[]>

      A promise that resolves to an array of the nodes that were pasted into the diagram.

    • Checks if the clipboard contains nodes that can be pasted into the diagram.

      Returns Promise<boolean>

      A promise that resolves to true if nodes are available for pasting, false otherwise.