(
blockDef: BlockDef,
targetBlockId: string,
position: "before" | "after"
)
| 360 | } |
| 361 | |
| 362 | async 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 | |
| 385 | async function createBlockSplitVertically( |
| 386 | blockDef: BlockDef, |
no test coverage detected