Stay organized with collections
Save and categorize content based on your preferences.
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
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-16 UTC."],[],[],null,["[blockly](./blockly.md) \\\u003e [LineCursor](./blockly.linecursor_class.md) \\\u003e [preDelete](./blockly.linecursor_class.predelete_1_method.md)\n\nLineCursor.preDelete() method\n-----------------------------\n\nPrepare 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.\n\nAfter the deletion has occurred, call postDelete to move it to the first valid node on that list.\n\nThe locations to try (in order of preference) are:\n\n- 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\nN.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.\n\n**Signature:** \n\n preDelete(deletedBlock: BlockSvg): void;\n\nParameters\n----------\n\n| Parameter | Type | Description |\n|--------------|-----------------------------------------|----------------------------------|\n| deletedBlock | [BlockSvg](./blockly.blocksvg_class.md) | The block that is being deleted. |\n\n**Returns:**\n\nvoid"]]