(blockDef: BlockDef, magnified = false, ephemeral = false)
| 406 | } |
| 407 | |
| 408 | async function createBlock(blockDef: BlockDef, magnified = false, ephemeral = false): Promise<string> { |
| 409 | const layoutModel = getLayoutModelForStaticTab(); |
| 410 | const rtOpts: RuntimeOpts = { termsize: { rows: 25, cols: 80 } }; |
| 411 | const blockId = await ObjectService.CreateBlock(blockDef, rtOpts); |
| 412 | if (ephemeral) { |
| 413 | layoutModel.newEphemeralNode(blockId); |
| 414 | return blockId; |
| 415 | } |
| 416 | const insertNodeAction: LayoutTreeInsertNodeAction = { |
| 417 | type: LayoutTreeActionType.InsertNode, |
| 418 | node: newLayoutNode(undefined, undefined, undefined, { blockId }), |
| 419 | magnified, |
| 420 | focused: true, |
| 421 | }; |
| 422 | layoutModel.treeReducer(insertNodeAction); |
| 423 | return blockId; |
| 424 | } |
| 425 | |
| 426 | async function replaceBlock(blockId: string, blockDef: BlockDef, focus: boolean): Promise<string> { |
| 427 | const layoutModel = getLayoutModelForStaticTab(); |
no test coverage detected