How to use the @projectstorm/react-canvas-core.DeleteItemsAction function in @projectstorm/react-canvas-core

To help you get started, we’ve selected a few @projectstorm/react-canvas-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github projectstorm / react-diagrams / packages / diagrams-demo-gallery / demos / demo-custom_delete_keys / index.tsx View on Github external
const port1 = node1.addOutPort('Out');

	const node2 = new DefaultNodeModel('Node 2', 'rgb(192,255,0)');
	const port2 = node2.addInPort('In');
	node2.setPosition(400, 100);

	const link1 = port1.link(port2);
	link1.getOptions().testName = 'Test';
	link1.addLabel('Hello World!');

	model.addAll(node1, node2, link1);

	engine.setModel(model);

	// register an DeleteItemsAction with custom keyCodes (in this case, only Delete key)
	engine.getActionEventBus().registerAction(new DeleteItemsAction({ keyCodes: [46] }));

	return (
		
			
		
	);
};