react-diagrams
react-diagrams copied to clipboard
Version 6 CanvasWidget deleteKeys alternative
Hello,
In version 5, the DiagramWidget have the deleteKeys prop, but at version 6, itsn't avaible, whats the alternative to do this? (i want to use only "Delete" to remove elements)
I was facing the same issue with Version 6. From what I have seen you can do the following options:
- Delete the DeleteItemsAction completely (or temporarily) from the eventBus (see #334 )
- Lock the model with
BaseModel.setLocked(true). I used this one for my nodes because they have multiple input fields. EverytimeonFocusfor the Textfield the corresponding model gets locked andonBlurit gets unlocked. This allows me to delete in the input field with [backspace] or [del] without deleting the node. Furthermore it blocks the node from dragging if I select something in the textfield.
Thanks, @christianbuehlmeyer . The option 2 looks great, I didn't remeber the setLocked function. In the first option, I need to modify the library source code, right? (the library don't export the DeleteItemsAction and the Action array are protected)