blockly > LineCursor > preDelete

LineCursor.preDelete() method

Prepare for the deletion of a block by making a list of nodes we could move the cursor to afterwards and save it to this.potentialNodes.

After the deletion has occurred, call postDelete to move it to the first valid node on that list.

The locations to try (in order of preference) are:

  • The current location. - The connection to which the deleted block is attached. - The block connected to the next connection of the deleted block. - The parent block of the deleted block. - A location on the workspace beneath the deleted block.

N.B.: When block is deleted, all of the blocks conneccted to that block's inputs are also deleted, but not blocks connected to its next connection.

Signature:

preDelete(deletedBlock: BlockSvg): void;

Parameters

Parameter Type Description
deletedBlock BlockSvg The block that is being deleted.

Returns:

void