Skip to content

Class: ReorderNodeCommand\<TRow\>

Defined in: src/tree-editor/commands/reorder-node.ts:16

Swaps a node with its previous (up) or next (down) sibling within the same parent. A no-op when the node is already at the edge of its sibling list — execute() returns the same state reference and undo() does nothing.

Type Parameters

TRow

TRow

Implements

Constructors

Constructor

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

Defined in: src/tree-editor/commands/reorder-node.ts:29

Parameters

options

ReorderNodeOptions

Returns

ReorderNodeCommand<TRow>

Properties

description

readonly description: string

Defined in: src/tree-editor/commands/reorder-node.ts:18

Human-readable description for undo/redo UI.

Implementation of

Command.description


type

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

Defined in: src/tree-editor/commands/reorder-node.ts:17

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/reorder-node.ts:35

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/reorder-node.ts:74

Reverse the mutation. Returns the previous tree state.

Parameters

state

TreeState<TRow>

Returns

TreeState<TRow>

Implementation of

Command.undo