CenterForDigitalHumanities / CenterForDigitalHumanities/TPEN-interfaces

Bridge a postMessage type to TPEN.eventDispatcher so iframed tools can refresh the page

Open
#528 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
2
Forks
3
PR merge metrics
No merged PRs in 30d

Description

## Problem

In-document components (e.g. `tpen-transcription-block`) can refresh the simple-transcription view after mutating project data because they share the `TPEN.eventDispatcher` singleton with `simple-transcription` — they dispatch on the bus and `simple-transcription` re-renders.

Iframed splitscreen tools cannot reach that bus. The only channel out is `postMessage`, and `simple-transcription/index.js#handleToolMessages` (line 942) currently only forwards `REQUEST_TPEN_ID_TOKEN` and routes line-navigation message types — there's no handler that lets a tool ask the parent to invalidate cached page data and repaint.

This blocks the JSON-paste fallback flow from refreshing the parent transcription view after a successful page PUT, and would block any future iframed tool that mutates project state.

## Suggestion

Pass the parent current interface in via TPEN_CONTEXT (such as /transcribe). That will give us the ability to know the parent interface, and the child can attempt parent navigation or refresh from there.

or

Pass a message back out from the iframed child that tells the parent to repaint.

When a copy-and-paste fallback succeeds we want to see the data in the interface. There is a cheap hack to force the parent interface to reload right now.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.