(children, props)
| 261 | }; |
| 262 | |
| 263 | const imageContextMenuPatch: NavContextMenuPatchCallback = (children, props) => { |
| 264 | if (!props) return; |
| 265 | |
| 266 | if ("href" in props && !props.src) return; |
| 267 | |
| 268 | const url = getMediaUrl(props); |
| 269 | if (!url) return; |
| 270 | |
| 271 | if (children.some(child => child?.props?.id === "file-upload-group")) return; |
| 272 | |
| 273 | const serviceType = settings.store.serviceType as ServiceType; |
| 274 | const serviceName = serviceLabels[serviceType]; |
| 275 | |
| 276 | children.push( |
| 277 | <Menu.MenuGroup id="file-upload-group"> |
| 278 | <Menu.MenuItem |
| 279 | label={`Upload to ${serviceName}`} |
| 280 | key="file-upload" |
| 281 | id="file-upload" |
| 282 | action={() => uploadFile(url)} |
| 283 | /> |
| 284 | </Menu.MenuGroup> |
| 285 | ); |
| 286 | }; |
| 287 | |
| 288 | async function handleUploadFileFromDraft(upload: CloudUpload) { |
| 289 | const file = upload.item?.file; |
nothing calls this directly
no test coverage detected