getDroppedShapesToNewParents

See source code

Get the shapes that will be reparented to new parents when the shapes are dropped.

function getDroppedShapesToNewParents(
  editor: Editor,
  shapes: Set<TLShape> | TLShape[],
  cb?: (shape: TLShape, parent: TLShape) => boolean,
): {
  remainingShapesToReparent: Set<TLShape>;
  reparenting: Map<TLShapeId, TLShape[]>;
};

Parameters

NameDescription

editor

Editor;

The editor instance.

shapes

Set<TLShape> | TLShape[];

The shapes to check.

cb

(shape: TLShape, parent: TLShape) => boolean;

A callback to filter out certain shapes.

Returns

{
  remainingShapesToReparent: Set<TLShape>;
  reparenting: Map<TLShapeId, TLShape[]>;
};

An object with the shapes that will be reparented to new parents and the shapes that will be reparented to the page or their ancestral group.

Prev
getDefaultCdnBaseUrl
Next
getFontsFromRichText