mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 00:48:25 +00:00
chore: Set modal as the selected widget when clicked (#11363)
This commit is contained in:
parent
f5cab90b5c
commit
a609b3cd7a
1 changed files with 12 additions and 1 deletions
|
|
@ -290,8 +290,19 @@ const Component = ({ children, ...restProps }) => {
|
|||
} = restProps['modalProps'];
|
||||
|
||||
const setSelectedComponentAsModal = useStore((state) => state.setSelectedComponentAsModal, shallow);
|
||||
|
||||
// When the modal body is clicked capture it and use the callback to set the selected component as modal
|
||||
const handleModalBodyClick = (event) => {
|
||||
const clickedComponentId = event.target.getAttribute('component-id');
|
||||
|
||||
// Check if the clicked element is part of the modal canvas & same widget with id
|
||||
if (id === clickedComponentId) {
|
||||
setSelectedComponentAsModal(id);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<BootstrapModal {...restProps}>
|
||||
<BootstrapModal {...restProps} onClick={handleModalBodyClick}>
|
||||
{showConfigHandler && (
|
||||
<ConfigHandle
|
||||
id={id}
|
||||
|
|
|
|||
Loading…
Reference in a new issue