Skip to content

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

@thehabes

Description

@thehabes

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions