react-diagrams
react-diagrams copied to clipboard
DeRegister DeleteItemsAction from Canvas Engine
At the constructor of the Canvas Engine, is registered the DeleteItemsAction, but this Action is not exported from the react-canvas-core libary , and there's no method to get and deregister it. Is there any workaround to remove this Action from the Engine without changing the library source code?
Same question here!
Terrible hack, I know:
let key = 0, subKey = 0
_.forEach(this.state.engine.getActionEventBus(), (actionBus) => {
_.forEach(actionBus, (action) => {
if (key === 0 && subKey === 1) // DeleteItemsAction
{
this.state.engine.getActionEventBus().deregisterAction(action)
}
subKey++
})
key++
})
}
Without the need of DeleteItemsAction or re-creating CanvasEngine.
I used lodash (the _.)