You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tools-dismiss is never dispatched anywhere in the codebase. Both interface shells only listen for it (simple-transcription/index.js:395, interfaces/transcription/index.js:275). The close button and Escape key call closeSplitscreen() directly without dispatching any event.
No tpen-{toolName}-hide event is dispatched on dismissal. The hide event is only dispatched by splitscreen-tool/index.js:61 during tool switching, not panel close.
Current Code (the actual close path in simple-transcription/index.js):
### Dismissal1. User clicks close button, presses Escape key, or an external component dispatches `tools-dismiss` via eventDispatcher
2. Interface shell calls `closeSplitscreen()` directly — sets `isSplitscreenActive = false` and collapses layout
3.**Note**: No `tpen-{toolName}-hide` event is currently dispatched on panel close (only on tool switch). Tools that need cleanup on dismiss should listen for DOM visibility changes or the `tools-dismiss` eventDispatcher event.
Issue 2: tpen-{toolName}-show/hide events are dispatched by splitscreen-tool, not the interface shell
Problem:
The Event Contracts table states the direction for show/hide events is "Interface → Tool". In reality, these events are dispatched by tpen-splitscreen-tool (the dropdown selector), not the interface shell:
Similarly, the tools-dismiss direction is listed as "Interface → Tools", but it is never dispatched by the interface — it is only listened for. Its actual dispatcher is currently unknown (possibly intended for future use or external callers).
Problem:
The documented tool configuration schema only shows toolName, label, location, and custom.enabled. However, the actual tool loading logic in simple-transcription/index.js:830-921 depends on two critical additional properties that determine how a tool is rendered:
tool.url — Used to load iframe tools (line 856-918) and custom element scripts (line 831-853)
tool.custom.tagName — Used to load native web component tools (line 830-853)
Without these properties documented, a developer cannot understand how tools are actually instantiated.
Suggested Fix:
{toolName: "dictionary",// Unique identifierlabel: "Dictionary",// Display namelocation: "pane",// Type: "pane" | "sidebar" | "drawer" | "dialog"url: "https://example.com/tool.js",// Optional: URL for iframe src or module scriptcustom: {enabled: true,// Optional: defaults to true if omittedtagName: "tpen-dictionary",// Optional: custom element tag name (requires url)// Tool-specific configuration}}
Add a note explaining the rendering decision tree:
If custom.tagName AND url → load script from url, then render <tagName>
If url AND no tagName AND location === 'pane' → render as iframe with src = url
Otherwise → fallback message
Minor Issues 🟡
Issue 4: iframe communication is described as "one-way" but the code is bidirectional
- Communication is bidirectional via `postMessage`:
- Interface → Tool: sends manifest, canvas, page, line context on load and line changes
- Tool → Interface: sends line navigation requests (`NAVIGATE_TO_LINE`, `SELECT_ANNOTATION`, etc.)
- Origin validation is enforced for incoming messages
Issue 5: Activation lifecycle step 5 is misleading
Tool-specific show event dispatched: tpen-${toolName}-show
This is listed as a separate step after "Interface updates state," implying the interface dispatches it. In reality, the show event is dispatched by splitscreen-tool in the same change event handler that fires splitscreen-toggle (line 56-62 of splitscreen-tool/index.js). Steps 2 and 5 happen in the same synchronous handler, not sequentially after the interface processes step 3-4.
Suggested Fix:
Reorder to reflect the actual sequence:
1. User selects tool from splitscreen dropdown
2.`splitscreen-tool` dispatches `splitscreen-toggle` DOM event with `{ selectedTool: toolName }`3.`splitscreen-tool` dispatches `tpen-${previousTool}-hide` (if switching) and `tpen-${toolName}-show` via eventDispatcher
4. Interface shell receives bubbled `splitscreen-toggle` event
5. Interface updates state, toggles layout, and loads tool content
Issue 6: Doc references only tpen-simple-transcription but the same patterns exist in interfaces/transcription/
Problem:
The document consistently references tpen-simple-transcription as the sole interface shell, but interfaces/transcription/index.js implements the same splitscreen patterns (same event listeners, same closeSplitscreen/openSplitscreen logic, same loadRightPaneContent method). The doc should acknowledge both consumers.
Suggested Fix:
Add a brief note in the "Interface Shell" section or the intro:
**Note**: The splitscreen patterns are implemented in both `tpen-simple-transcription`
(`components/simple-transcription/index.js`) and the standard transcription interface
(`interfaces/transcription/index.js`). Both follow the same event contracts.
Suggestions 🔵
Suggestion 1: Document the postMessage protocol for iframe tools
The iframe integration is a non-trivial protocol with multiple message types (MANIFEST_CANVAS_ANNOTATIONPAGE_ANNOTATION, CANVASES, CURRENT_LINE_INDEX, SELECT_ANNOTATION, RETURN_LINE_ID, NAVIGATE_TO_LINE). Third-party tool developers would benefit from a message contract table similar to the event contracts table. This could live in this doc or a separate iframe tools reference doc.
Suggestion 2: Add a simple ASCII or mermaid diagram for the event flow
The lifecycle sections describe a multi-step flow across 3+ components. A sequence diagram (even simple ASCII) would make the event routing much clearer than prose, especially given the nuance of who dispatches what.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.