ValidateUnembedding
type ValidateUnembedding = (context) => boolean;
Decides whether an embedded element may be detached from its parent. Return
true to allow detaching, false to keep it embedded. Pass it to the
validateUnembedding prop of <Paper>; the callback receives a structured
ValidateUnembeddingParams context.
Parameters
| Parameter | Type |
|---|---|
context | ValidateUnembeddingParams |
Returns
boolean
Example
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>;