puck
puck copied to clipboard
fix: add optional ref prop to DropZones and slots
Closes #1439
Description
This PR fixes a type issue where refs were not accepted in Slot render functions or DropZones, which did not match internal or documented behavior.
Changes made
- The
DropZonePropstype now includes an optionalrefprop.
How to test
- Define a component that uses a slot and pass a ref to that slot:
SomeSlot: {
fields: {
content: { type: "slot" },
},
render: ({ content: Content }) => {
const ref = useRef<HTMLDivElement>(null);
return <Content ref={ref} />;
},
},
- Confirm that TypeScript does not throw an error.