MCPcopy Create free account
hub / github.com/wavetermdev/waveterm / TermVDomToolbarNode

Function TermVDomToolbarNode

frontend/app/view/term/term.tsx:70–111  ·  view source on GitHub ↗
({ vdomBlockId, blockId, model }: TerminalViewProps & { vdomBlockId: string })

Source from the content-addressed store, hash-verified

68});
69
70const TermVDomToolbarNode = ({ vdomBlockId, blockId, model }: TerminalViewProps & { vdomBlockId: string }) => {
71 React.useEffect(() => {
72 const unsub = waveEventSubscribeSingle({
73 eventType: "blockclose",
74 scope: WOS.makeORef("block", vdomBlockId),
75 handler: (_event) => {
76 RpcApi.SetMetaCommand(TabRpcClient, {
77 oref: WOS.makeORef("block", blockId),
78 meta: {
79 "term:mode": null,
80 "term:vdomtoolbarblockid": null,
81 },
82 });
83 },
84 });
85 return () => {
86 unsub();
87 };
88 }, []);
89 const vdomNodeModel: BlockNodeModel = React.useMemo(
90 () => ({
91 blockId: vdomBlockId,
92 isFocused: jotai.atom(false),
93 isMagnified: jotai.atom(false),
94 focusNode: () => {},
95 toggleMagnify: () => {},
96 onClose: () => {
97 if (vdomBlockId != null) {
98 RpcApi.DeleteSubBlockCommand(TabRpcClient, { blockid: vdomBlockId });
99 }
100 },
101 }),
102 [vdomBlockId]
103 );
104 const toolbarTarget = jotai.useAtomValue(model.vdomToolbarTarget);
105 const heightStr = toolbarTarget?.height ?? "1.5em";
106 return (
107 <div key="vdomToolbar" className="term-toolbar" style={{ height: heightStr }}>
108 <SubBlock key="vdom" nodeModel={vdomNodeModel} />
109 </div>
110 );
111};
112
113const TermVDomNodeSingleId = ({ vdomBlockId, blockId, model }: TerminalViewProps & { vdomBlockId: string }) => {
114 React.useEffect(() => {

Callers

nothing calls this directly

Calls 3

waveEventSubscribeSingleFunction · 0.90
SetMetaCommandMethod · 0.65
DeleteSubBlockCommandMethod · 0.65

Tested by

no test coverage detected