Skip to main content

Class: BlockDelete

Defined in: packages/blockly/core/events/events_block_delete.ts:26

Notifies listeners when a block (or connected stack of blocks) is deleted.

Extends

Properties index

PropertyDescription
workspaceIdThe workspace identifier for this event.
groupAn ID for the group of events this block is associated with.
recordUndoWhether this event is undoable or not.
isUiEventWhether or not the event is a UI event.
isBlankWhether or not the event was constructed without necessary parameters (to be populated by fromJson).
blockIdThe ID of the block associated with this event.
oldJsonThe JSON respresentation of the deleted block(s).
idsAll of the IDs of deleted blocks.
wasShadowTrue if the deleted block was a shadow block, false otherwise.
typeType of this event.

Methods index

MethodDescription
isNullDoes this event record any change of state?
getEventWorkspace_Get workspace the event belongs to.
toJsonEncode the event as JSON.
runRun a deletion event.

Constructors

Constructor

new BlockDelete(opt_block?): BlockDelete;

Defined in: packages/blockly/core/events/events_block_delete.ts:39

Parameters

ParameterTypeDescription
opt_block?BlockThe deleted block. Undefined for a blank event.

Returns

BlockDelete

Overrides

BlockBase.constructor

Properties

workspaceId?

optional workspaceId?: string = undefined;

Defined in: packages/blockly/core/events/events_abstract.ts:30

The workspace identifier for this event.

Inherited from

BlockBase.workspaceId


group

group: string;

Defined in: packages/blockly/core/events/events_abstract.ts:38

An ID for the group of events this block is associated with.

Groups define events that should be treated as an single action from the user's perspective, and should be undone together.

Inherited from

BlockBase.group


recordUndo

recordUndo: boolean;

Defined in: packages/blockly/core/events/events_abstract.ts:41

Whether this event is undoable or not.

Inherited from

BlockBase.recordUndo


isUiEvent

isUiEvent: boolean = false;

Defined in: packages/blockly/core/events/events_abstract.ts:44

Whether or not the event is a UI event.

Inherited from

BlockBase.isUiEvent


isBlank

isBlank: boolean = true;

Defined in: packages/blockly/core/events/events_block_base.ts:25

Whether or not the event was constructed without necessary parameters (to be populated by fromJson).

Inherited from

BlockBase.isBlank


blockId?

optional blockId?: string;

Defined in: packages/blockly/core/events/events_block_base.ts:28

The ID of the block associated with this event.

Inherited from

BlockBase.blockId


oldJson?

optional oldJson?: State;

Defined in: packages/blockly/core/events/events_block_delete.ts:28

The JSON respresentation of the deleted block(s).


ids?

optional ids?: string[];

Defined in: packages/blockly/core/events/events_block_delete.ts:31

All of the IDs of deleted blocks.


wasShadow?

optional wasShadow?: boolean;

Defined in: packages/blockly/core/events/events_block_delete.ts:34

True if the deleted block was a shadow block, false otherwise.


type

type: EventType = EventType.BLOCK_DELETE;

Defined in: packages/blockly/core/events/events_block_delete.ts:36

Type of this event.

Overrides

BlockBase.type

Methods

isNull()

isNull(): boolean;

Defined in: packages/blockly/core/events/events_abstract.ts:91

Does this event record any change of state?

Returns

boolean

True if null, false if something changed.

Inherited from

BlockBase.isNull


getEventWorkspace_()

getEventWorkspace_(): Workspace;

Defined in: packages/blockly/core/events/events_abstract.ts:111

Get workspace the event belongs to.

Returns

Workspace

The workspace the event belongs to.

Throws

if workspace is null.

Inherited from

BlockBase.getEventWorkspace_


toJson()

toJson(): BlockDeleteJson;

Defined in: packages/blockly/core/events/events_block_delete.ts:66

Encode the event as JSON.

Returns

BlockDeleteJson

JSON representation.

Overrides

BlockBase.toJson


run()

run(forward): void;

Defined in: packages/blockly/core/events/events_block_delete.ts:128

Run a deletion event.

Parameters

ParameterTypeDescription
forwardbooleanTrue if run forward, false if run backward (undo).

Returns

void

Overrides

BlockBase.run