Is there an event right before the paste in diagram's copy and paste?

Hi,

I want to modify something for a specific node after the paste is completed.

I'm currently using Vue 2 and



initializeDiagram() {

    Diagram.Inject(

        ConnectorEditing,

        Snapping,

        SymmetricLayout,

        BpmnDiagrams,

    );


    this.diagramInstance = new Diagram({

        width: this.diagramwidth,

        height: this.diagramheight,

        nodes: this.nodes,

        connectors: this.connectors,

        snapSettings: this.snapSettings,

        rulerSettings: this.rulerSettings,

        getNodeDefaults: this.getNodeDefaults,

        getConnectorDefaults: this.getConnectorDefaults,

        dragEnter: this.dragEnter,

        drop: this.drop,

        click: this.click,

        doubleClick: this.doubleClick,

        collectionChange: this.collectionChange,

        connectionChange: this.connectionChange,

        scrollSettings: {

            scrollLimit: "Infinity",

            verticalOffset: 0,

        },

    });

using it like this.


It's currently working with ctrl+c and ctrl+v without any separate keyup/keydown settings, but I want to add logic after ctrl+v triggers the paste operation.

Thank you.




1 Reply

MG Moulidharan Gopalakrishnan Syncfusion Team November 4, 2024 09:30 AM UTC

Hi,

In the diagram component, we have keyDown and keyUp events that trigger when any key is pressed. You can use these events to bind the custom logic you wish to implement. For example, after the paste action (Ctrl + V), you can access the newly pasted node from the event arguments (args.element) and apply any modifications needed. Also you can customize the keyboard actions by modifying existing commands with command manager. Please refer the sample and Documentation


Sample” Kq31xc (forked) - StackBlitz

Documentation:
Vue Diagram API component - Syncfusion
Commands in Vue Diagram component | Syncfusion

Regards,
Moulidharan


Loader.
Up arrow icon