Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion components/simple-transcription/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,20 @@ export default class SimpleTranscriptionInterface extends HTMLElement {
const projectPage = TPEN.activeProject?.layers
?.flatMap(layer => layer.pages || [])
.find(p => p.id.split('/').pop() === currentPageId)


// Forward auth to TPEN-Prompts only; other tools do not receive the token.
if (tool.toolName === 'tpen-prompts') {
iframe.contentWindow?.postMessage(
{
type: "AUTH_TOKEN",
token: this.userToken ?? null,
projectID: TPEN.screen?.projectInQuery ?? null,
pageID: currentPageId ?? null
},
this._iframeOrigin
)
}

iframe.contentWindow?.postMessage(
{
type: "MANIFEST_CANVAS_ANNOTATIONPAGE_ANNOTATION",
Expand Down
13 changes: 13 additions & 0 deletions interfaces/transcription/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,19 @@ export default class TranscriptionInterface extends HTMLElement {
this._iframeOrigin = new URL(tool.url).origin

iframe.addEventListener('load', () => {
// Forward auth to TPEN-Prompts only; other tools do not receive the token.
if (tool.toolName === 'tpen-prompts') {
iframe.contentWindow?.postMessage(
{
type: "AUTH_TOKEN",
token: this.userToken ?? null,
projectID: TPEN.screen?.projectInQuery ?? null,
pageID: TPEN.screen?.pageInQuery ?? null
},
this._iframeOrigin
)
}

iframe.contentWindow?.postMessage(
{
type: "MANIFEST_CANVAS_ANNOTATIONPAGE_ANNOTATION",
Expand Down
Loading