Skip to content

Class: InsertSubtreeCommand\<TRow\>

Defined in: src/tree-editor/commands/insert-subtree.ts:27

Inserts a freshly-cloned subtree under a target parent. Used by the paste flow — the caller (clipboard) produces a clone via cloneSubtree and then issues this command so the change is undoable.

Undo removes every inserted node from the state.

Type Parameters

TRow

TRow

Implements

Constructors

Constructor

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

Defined in: src/tree-editor/commands/insert-subtree.ts:36

Parameters

options

InsertSubtreeOptions<TRow>

Returns

InsertSubtreeCommand<TRow>

Properties

description

readonly description: string

Defined in: src/tree-editor/commands/insert-subtree.ts:29

Human-readable description for undo/redo UI.

Implementation of

Command.description


type

readonly type: "insert-subtree" = 'insert-subtree'

Defined in: src/tree-editor/commands/insert-subtree.ts:28

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/insert-subtree.ts:47

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/insert-subtree.ts:90

Reverse the mutation. Returns the previous tree state.

Parameters

state

TreeState<TRow>

Returns

TreeState<TRow>

Implementation of

Command.undo