MCPcopy
hub / github.com/wavetermdev/waveterm / focusNode

Method focusNode

frontend/layout/lib/layoutModel.ts:1230–1248  ·  view source on GitHub ↗

* Set the layout to focus on the given node. * @param nodeId The id of the node that is being focused.

(nodeId: string)

Source from the content-addressed store, hash-verified

1228 * @param nodeId The id of the node that is being focused.
1229 */
1230 focusNode(nodeId: string) {
1231 if (this.focusedNodeId === nodeId) return;
1232 let layoutNode = findNode(this.treeState?.rootNode, nodeId);
1233 if (!layoutNode) {
1234 const ephemeralNode = this.getter(this.ephemeralNode);
1235 if (ephemeralNode?.id === nodeId) {
1236 layoutNode = ephemeralNode;
1237 } else {
1238 console.error("unable to focus node, cannot find it in tree", nodeId);
1239 return;
1240 }
1241 }
1242 const action: LayoutTreeFocusNodeAction = {
1243 type: LayoutTreeActionType.FocusNode,
1244 nodeId: nodeId,
1245 };
1246
1247 this.treeReducer(action);
1248 }
1249
1250 focusFirstNode() {
1251 const leafOrder = this.getter(this.leafOrder);

Callers 12

getNodeModelMethod · 0.95
focusFirstNodeMethod · 0.95
newEphemeralNodeMethod · 0.95
setNodeFocusFunction · 0.80
refocusNodeFunction · 0.80
refocusNodeMethod · 0.80
handle_setblockfocusMethod · 0.80
TermVDomNodeSingleIdFunction · 0.80
webviewFocusFunction · 0.80
block.tsxFile · 0.80

Calls 2

treeReducerMethod · 0.95
findNodeFunction · 0.90

Tested by

no test coverage detected