Context handed to a ValidateUnembedding callback when an embedded element is dragged out of its parent.
Context handed to a ValidateUnembedding callback when an embedded element is dragged out of its parent.
Readonlychild: { id: ID; model: Element }The embedded element being dragged out of its parent.
Readonlygraph: GraphThe graph the element belongs to.
Readonlypaper: PaperThe paper the element lives on.
import { GraphProvider, Paper } from '@joint/react';
import type { ValidateUnembedding } from '@joint/react';
// Keep "locked" elements embedded; everything else can be dragged out.
const validate: ValidateUnembedding = ({ child }) => !child.model.get('locked');
<GraphProvider>
<Paper validateUnembedding={validate} renderElement={() => <rect width={80} height={40} />} />
</GraphProvider>;
Decides whether an embedded element may be detached from its parent. Return
trueto allow detaching,falseto keep it embedded. Pass it to thevalidateUnembeddingprop of<Paper>; the callback receives a structured ValidateUnembeddingParams context.