Skip to content

Class: DeleteNodeCommand\<TRow\>

Defined in: src/tree-editor/commands/delete-node.ts:13

Removes a node and its entire subtree. The command captures the deleted subtree and the node’s position among its siblings so undo can restore the exact prior state.

Type Parameters

TRow

TRow

Implements

Constructors

Constructor

new DeleteNodeCommand<TRow>(options): DeleteNodeCommand<TRow>

Defined in: src/tree-editor/commands/delete-node.ts:25

Parameters

options

DeleteNodeOptions

Returns

DeleteNodeCommand<TRow>

Properties

description

readonly description: string

Defined in: src/tree-editor/commands/delete-node.ts:15

Human-readable description for undo/redo UI.

Implementation of

Command.description


type

readonly type: "delete-node" = 'delete-node'

Defined in: src/tree-editor/commands/delete-node.ts:14

Unique command type identifier (e.g., ‘add-node’, ‘move-node’).

Implementation of

Command.type

Methods

execute()

execute(state): TreeState<TRow>

Defined in: src/tree-editor/commands/delete-node.ts:30

Apply the mutation. Returns the new tree state.

Parameters

state

TreeState<TRow>

Returns

TreeState<TRow>

Implementation of

Command.execute


undo()

undo(state): TreeState<TRow>

Defined in: src/tree-editor/commands/delete-node.ts:73

Reverse the mutation. Returns the previous tree state.

Parameters

state

TreeState<TRow>

Returns

TreeState<TRow>

Implementation of

Command.undo