(
blockDef: BlockDef,
targetBlockId: string,
position: "before" | "after"
)
| 383 | } |
| 384 | |
| 385 | async function createBlockSplitVertically( |
| 386 | blockDef: BlockDef, |
| 387 | targetBlockId: string, |
| 388 | position: "before" | "after" |
| 389 | ): Promise<string> { |
| 390 | const layoutModel = getLayoutModelForStaticTab(); |
| 391 | const rtOpts: RuntimeOpts = { termsize: { rows: 25, cols: 80 } }; |
| 392 | const newBlockId = await ObjectService.CreateBlock(blockDef, rtOpts); |
| 393 | const targetNodeId = layoutModel.getNodeByBlockId(targetBlockId)?.id; |
| 394 | if (targetNodeId == null) { |
| 395 | throw new Error(`targetNodeId not found for blockId: ${targetBlockId}`); |
| 396 | } |
| 397 | const splitAction: LayoutTreeSplitVerticalAction = { |
| 398 | type: LayoutTreeActionType.SplitVertical, |
| 399 | targetNodeId: targetNodeId, |
| 400 | newNode: newLayoutNode(undefined, undefined, undefined, { blockId: newBlockId }), |
| 401 | position: position, |
| 402 | focused: true, |
| 403 | }; |
| 404 | layoutModel.treeReducer(splitAction); |
| 405 | return newBlockId; |
| 406 | } |
| 407 | |
| 408 | async function createBlock(blockDef: BlockDef, magnified = false, ephemeral = false): Promise<string> { |
| 409 | const layoutModel = getLayoutModelForStaticTab(); |
no test coverage detected