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

Function createBlock

frontend/app/store/global.ts:408–424  ·  view source on GitHub ↗
(blockDef: BlockDef, magnified = false, ephemeral = false)

Source from the content-addressed store, hash-verified

406}
407
408async 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
426async function replaceBlock(blockId: string, blockDef: BlockDef, focus: boolean): Promise<string> {
427 const layoutModel = getLayoutModelForStaticTab();

Callers 10

handleContextMenuFunction · 0.90
getConnectionsEditItemFunction · 0.90
openDiffMethod · 0.90
openWaveAIConfigMethod · 0.90
handleCmdNFunction · 0.90
TermStickerFunction · 0.90
getContextMenuItemsMethod · 0.90
getSettingsMenuItemsMethod · 0.90
addOpenMenuItemsFunction · 0.90
openLinkFunction · 0.85

Calls 5

newLayoutNodeFunction · 0.85
newEphemeralNodeMethod · 0.80
treeReducerMethod · 0.80
CreateBlockMethod · 0.45

Tested by

no test coverage detected