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

Function handleContextMenu

frontend/app/app.tsx:104–138  ·  view source on GitHub ↗
(e: React.MouseEvent<HTMLDivElement>)

Source from the content-addressed store, hash-verified

102}
103
104async function handleContextMenu(e: React.MouseEvent<HTMLDivElement>) {
105 e.preventDefault();
106 const canPaste = canEnablePaste();
107 const canCopy = canEnableCopy();
108 const canCut = canEnableCut();
109 const clipboardURL = await getClipboardURL();
110 if (!canPaste && !canCopy && !canCut && !clipboardURL) {
111 return;
112 }
113 const menu: ContextMenuItem[] = [];
114 if (canCut) {
115 menu.push({ label: "Cut", role: "cut" });
116 }
117 if (canCopy) {
118 menu.push({ label: "Copy", role: "copy" });
119 }
120 if (canPaste) {
121 menu.push({ label: "Paste", role: "paste" });
122 }
123 if (clipboardURL) {
124 menu.push({ type: "separator" });
125 menu.push({
126 label: "Open Clipboard URL (" + clipboardURL.hostname + ")",
127 click: () => {
128 createBlock({
129 meta: {
130 view: "web",
131 url: clipboardURL.toString(),
132 },
133 });
134 },
135 });
136 }
137 ContextMenuModel.getInstance().showContextMenu(menu, e);
138}
139
140function AppSettingsUpdater() {
141 const windowSettingsAtom = getSettingsPrefixAtom("window");

Callers

nothing calls this directly

Calls 8

createBlockFunction · 0.90
canEnablePasteFunction · 0.85
canEnableCopyFunction · 0.85
canEnableCutFunction · 0.85
getClipboardURLFunction · 0.85
pushMethod · 0.80
showContextMenuMethod · 0.80
getInstanceMethod · 0.45

Tested by

no test coverage detected