MCPcopy Create free account
hub / github.com/wavetermdev/waveterm / addIntermediateNode

Function addIntermediateNode

frontend/layout/lib/layoutNode.ts:75–91  ·  view source on GitHub ↗
(node: LayoutNode)

Source from the content-addressed store, hash-verified

73 * @returns The updated node and the node that was added.
74 */
75export function addIntermediateNode(node: LayoutNode): LayoutNode {
76 let intermediateNode: LayoutNode;
77
78 if (node.data) {
79 intermediateNode = newLayoutNode(reverseFlexDirection(node.flexDirection), undefined, undefined, node.data);
80 node.children = [intermediateNode];
81 node.data = undefined;
82 } else {
83 const intermediateNodeInner = newLayoutNode(node.flexDirection, undefined, node.children);
84 intermediateNode = newLayoutNode(reverseFlexDirection(node.flexDirection), undefined, [intermediateNodeInner]);
85 node.children = [intermediateNode];
86 }
87 const intermediateNodeId = intermediateNode.id;
88 intermediateNode.id = node.id;
89 node.id = intermediateNodeId;
90 return intermediateNode;
91}
92
93/**
94 * Attempts to remove the specified node from its parent.

Callers 3

moveNodeFunction · 0.90
layoutNode.test.tsFile · 0.90
addChildAtFunction · 0.85

Calls 2

reverseFlexDirectionFunction · 0.90
newLayoutNodeFunction · 0.85

Tested by

no test coverage detected