@joint/react
    Preparing search index...

    Type Alias ValidateUnembedding

    ValidateUnembedding: (context: ValidateUnembeddingParams) => 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.

    Type Declaration

      • (context: ValidateUnembeddingParams): boolean
      • Parameters

        • context: ValidateUnembeddingParams

          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: Graph

            The graph the element belongs to.

          • Readonlypaper: Paper

            The paper the element lives on.

        Returns boolean

    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>;