eLabSDK2.Journal.Experiment.Section.ImageSection
Hierarchy
-
↳
ImageSection
Methods
attachExternalImage
Static attachExternalImage(config): Promise<void>
Queue an external image (e.g. a cloud-storage provider's authenticated
download URL) for attach into an IMAGE section.
Just enqueues a request — the rebuilt image-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 image
upload pipeline (the same path a disk image upload takes, including the
image-format validation).
fetchUrl MUST be a cross-origin https:// URL — the host rejects
same-origin URLs to keep the sandbox boundary intact.
Parameters
| Name | Type |
|---|---|
config | AttachExternalImageConfig |
Returns
Promise<void>
Resolves once the request is queued. Upload
completion / failure is reported via the image section's normal toast
stream — the addon does not need to await individual image results.
Example
await eLabSDK2.Journal.Experiment.ExperimentSection.ImageSection.attachExternalImage({
expJournalID: 12345,
fileName: 'figure.png',
fetchUrl: item.authenticated_download_url,
fetchHeaders: { Authorization: 'Bearer ' + token },
});registerAction
Static registerAction(action): void
Register a custom action on rebuilt IMAGE sections (e.g. an "Add image
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 "Upload image" button, mirroring the FILES section. 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 IMAGE-section actions the host calls onClick with one argument: { sectionId: number }. |
Returns
void
Example
eLabSDK2.Journal.Experiment.ExperimentSection.ImageSection.registerAction({
id: 'box-add-image',
label: 'Add image from Box.com',
icon: 'fas fa-plus',
onClick: (ctx) => openBoxPicker(ctx.sectionId),
});unregisterAction
Static unregisterAction(id): void
Remove a previously-registered IMAGE section action.
Parameters
| Name | Type | Description |
|---|---|---|
id | string | The id used at registration time. |
Returns
void
© 2026 eLabNext
Updated 2 days ago