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

Function createBlockSplitHorizontally

frontend/app/store/global.ts:362–383  ·  view source on GitHub ↗
(
    blockDef: BlockDef,
    targetBlockId: string,
    position: "before" | "after"
)

Source from the content-addressed store, hash-verified

360}
361
362async function createBlockSplitHorizontally(
363 blockDef: BlockDef,
364 targetBlockId: string,
365 position: "before" | "after"
366): Promise<string> {
367 const layoutModel = getLayoutModelForStaticTab();
368 const rtOpts: RuntimeOpts = { termsize: { rows: 25, cols: 80 } };
369 const newBlockId = await ObjectService.CreateBlock(blockDef, rtOpts);
370 const targetNodeId = layoutModel.getNodeByBlockId(targetBlockId)?.id;
371 if (targetNodeId == null) {
372 throw new Error(`targetNodeId not found for blockId: ${targetBlockId}`);
373 }
374 const splitAction: LayoutTreeSplitHorizontalAction = {
375 type: LayoutTreeActionType.SplitHorizontal,
376 targetNodeId: targetNodeId,
377 newNode: newLayoutNode(undefined, undefined, undefined, { blockId: newBlockId }),
378 position: position,
379 focused: true,
380 };
381 layoutModel.treeReducer(splitAction);
382 return newBlockId;
383}
384
385async function createBlockSplitVertically(
386 blockDef: BlockDef,

Callers 3

handleSplitHorizontalFunction · 0.90
getSettingsMenuItemsMethod · 0.90

Calls 5

newLayoutNodeFunction · 0.85
getNodeByBlockIdMethod · 0.80
treeReducerMethod · 0.80
CreateBlockMethod · 0.45

Tested by

no test coverage detected