CenterForDigitalHumanities / CenterForDigitalHumanities/TPEN-interfaces
Broaden TPEN_CONTEXT.siblings to span all layers, not just the active one
- Dominant language
- JavaScript
- Stars
- 2
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
Surfaced during testing of the `5-2-tools-align` cut (PR #564). The `TPEN_CONTEXT.canvases` array sent to tool iframes only includes pages from the *single layer that contains the active page*. For a project with multiple layers (e.g. "Layer 1 Page 1" + "Layer 2 Page 1"), only the active layer's pages reach the tool — Compare-Pages' dropdown is correspondingly limited.
This is a pre-existing gap, not introduced by #564. The legacy `CANVASES` payload (now removed) used the same single-layer `.find(layer)?.pages?.flatMap(...)` shape (see `1196c28:components/simple-transcription/index.js` lines 1070-1072), so `#getActiveLayerCanvases` was a faithful 1:1 port — but the constraint pre-dates the contract cleanup and is worth lifting.
## Required change
Broaden `#getActiveLayerCanvases` (in `components/simple-transcription/index.js`) to flatten across **all** layers, not just the active one. Likely shape:
```js
#getProjectCanvases() {
return TPEN.activeProject?.layers
?.flatMap(l => l.pages ?? [])
.map(p => ({ id: p.target, label: p.label })) ?? []
}
```
Consider renaming to `#getProjectCanvases` since "active layer" no longer describes the result. Update the JSDoc on `#buildTPENContext` to clarify the list spans all layers.
## Companion repo
Compare-Pages (CenterForDigitalHumanities/Compare-Pages) consumes `canvases` directly without filtering, so no code change is needed there once this lands. Its PR CenterForDigitalHumanities/Compare-Pages#3 will start showing the cross-layer list automatically.
## Verification
On a multi-layer project, open `/transcribe`, attach Compare-Pages, and confirm the dropdown lists every page across every layer.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.