eLabSDK2.Journal.Experiment.Section.FileSection
Hierarchy
-
↳
FileSection
Methods
attachExternalFile
Static attachExternalFile(config): Promise<void>
Queue an external file (e.g. a cloud-storage provider's authenticated download URL) for attach into a FILES or IMAGES section.
Just enqueues a request — the rebuilt file-section component picks the
entry up, fetches the URL on the host (where CSP allows the provider's
domain), wraps it in a File, and runs it through the existing
uploadFiles pipeline (XHR add-file, useFileUploadProgress,
toasts, refetch). Behaviour matches a disk upload exactly.
fetchUrl MUST be a cross-origin https:// URL — the host rejects
same-origin URLs to keep the sandbox boundary intact.
Parameters
| Name | Type |
|---|---|
config | AttachExternalFileConfig |
Returns
Promise<void>
Resolves once the request is queued. Upload completion / failure is reported via the file section's normal toast stream — the addon does not need to await individual file results.
Example
await eLabSDK2.Journal.Experiment.ExperimentSection.FileSection.attachExternalFile({
expJournalID: 12345,
fileName: 'report.pdf',
fetchUrl: item.authenticated_download_url,
fetchHeaders: { Authorization: 'Bearer ' + token },
});registerAction
Static registerAction(action): void
Register a custom action on rebuilt FILES sections (e.g. an "Add file from Box.com" entry contributed by a marketplace add-on).
The host renders each registered action as a primary toolbar button next
to the built-in "Link file" / "Upload file" buttons. Overflow into a
"More section actions" menu is not yet implemented — additional add-ons
extend the toolbar row directly. The host invokes onClick with
{ sectionId } so the handler learns which section was clicked without
reading any race-prone shared state.
Parameters
| Name | Type | Description |
|---|---|---|
action | Action | The standard SDK action (id, label, icon, onClick, …). For FILES-section actions the host calls onClick with one argument: { sectionId: number }. |
Returns
void
Example
eLabSDK2.Journal.Experiment.ExperimentSection.FileSection.registerAction({
id: 'box-add-file',
label: 'Add file from Box.com',
icon: 'fas fa-plus',
onClick: (ctx) => openBoxPicker(ctx.sectionId),
});unregisterAction
Static unregisterAction(id): void
Remove a previously-registered FILES section action.
Parameters
| Name | Type | Description |
|---|---|---|
id | string | The id used at registration time. |
Returns
void
© 2026 eLabNext
Updated about 4 hours ago