diff --git a/README.md b/README.md index e8439c44..b9c192a3 100644 --- a/README.md +++ b/README.md @@ -855,5 +855,4 @@ This component is heavily inspired by [react-json-view](https://github.com/mac-s - Better internal handling of functions in data - **0.9.3**: Bundle as ES6 module - **0.9.1**: Export more Types from the package -- **0.9.0**: Initial release - +- **0.9.0**: Initial release \ No newline at end of file diff --git a/src/ButtonPanels.tsx b/src/ButtonPanels.tsx index e7ec03cc..18d1bb85 100644 --- a/src/ButtonPanels.tsx +++ b/src/ButtonPanels.tsx @@ -126,8 +126,8 @@ export const EditButtons: React.FC = ({ )} {customButtons?.map(({ Element, onClick }, i) => ( -
onClick(nodeData, e)}> - +
onClick && onClick(nodeData, e)}}> +
))} {isAdding && handleAdd && type === 'object' && ( diff --git a/src/types.ts b/src/types.ts index e31f0841..849466d3 100644 --- a/src/types.ts +++ b/src/types.ts @@ -284,7 +284,7 @@ export interface CustomNodeDefinition, U = Record export interface CustomButtonDefinition { - Element: React.FC + Element: React.FC<{ nodeData: NodeData }> onClick: (nodeData: NodeData, e: React.MouseEvent) => void }