Closed smartball closed 4 years ago
The event is checked in the CanvasInner, so you have to use a custom component to overwrite it.
import { CanvasInnerDefault } from "@mrblenny/react-flow-chart";
import React from 'react';
const CustomCanvasInner = ({children, config, onKeyDown, ...args}) => {
const handleKeyDown = (e) => {
if (e.keyCode === 46) {
return {...onKeyDown(e)}
}
}
return (
<CanvasInnerDefault {...args} onKeyDown={handleKeyDown}>
{children}
</CanvasInnerDefault>
)
}
export default CustomCanvasInner;
The event is checked in the CanvasInner, so you have to use a custom component to overwrite it.
import { CanvasInnerDefault } from "@mrblenny/react-flow-chart"; import React from 'react'; const CustomCanvasInner = ({children, config, onKeyDown, ...args}) => { const handleKeyDown = (e) => { if (e.keyCode === 46) { return {...onKeyDown(e)} } } return ( <CanvasInnerDefault {...args} onKeyDown={handleKeyDown}> {children} </CanvasInnerDefault> ) } export default CustomCanvasInner;
Wow. It work. Thank you so much mr.@davidanitoiu .
I want to know how to disable backspace to remove node element (not custom node_modules). help me please.