MCPcopy Create free account
hub / github.com/ScattrdBlade/bigFileUpload / messageContextMenuPatch

Function messageContextMenuPatch

index.tsx:237–261  ·  view source on GitHub ↗
(children, props)

Source from the content-addressed store, hash-verified

235const ProgressBar = ErrorBoundary.wrap(ProgressBarInner, { noop: true });
236
237const messageContextMenuPatch: NavContextMenuPatchCallback = (children, props) => {
238 if (!props) return;
239
240 const { itemSrc, itemHref, target } = props;
241 const url = getMediaUrl({ src: itemSrc, href: itemHref, target });
242
243 if (!url) return;
244
245 const group = findGroupChildrenByChildId("open-native-link", children)
246 ?? findGroupChildrenByChildId("copy-link", children);
247
248 if (group && !group.some(child => child?.props?.id === "file-upload")) {
249 const serviceType = settings.store.serviceType as ServiceType;
250 const serviceName = serviceLabels[serviceType];
251
252 group.push(
253 <Menu.MenuItem
254 label={`Upload to ${serviceName}`}
255 key="file-upload"
256 id="file-upload"
257 action={() => uploadFile(url)}
258 />
259 );
260 }
261};
262
263const imageContextMenuPatch: NavContextMenuPatchCallback = (children, props) => {
264 if (!props) return;

Callers

nothing calls this directly

Calls 2

getMediaUrlFunction · 0.90
uploadFileFunction · 0.90

Tested by

no test coverage detected