Repository navigation
feat(apollo-wind): honor \{{ escape and host clipboard hooks in prompt editor - #1217
akraminakib wants to merge 1 commit into
Conversation
|
Apollo Coded App preview deployments are ready.
|
Dependency License Review
License distribution
Excluded packages
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
One or more issues must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
Adds escaped \{{ clipboard handling and host-configurable clipboard codecs to the Apollo Wind prompt editor.
Changes:
- Escapes literal
{{sequences during clipboard serialization. - Adds host parser/serializer props and plugin wiring.
- Adds stories and serialization/paste tests.
| File | Description |
|---|---|
| packages/apollo-wind/src/components/ui/prompt-editor/utils/serialization.ts | Updated as part of this pull request. |
| packages/apollo-wind/src/components/ui/prompt-editor/utils/serialization.test.ts | Updated as part of this pull request. |
| packages/apollo-wind/src/components/ui/prompt-editor/prompt-editor.tsx | Updated as part of this pull request. |
| packages/apollo-wind/src/components/ui/prompt-editor/prompt-editor.stories.tsx | Updated as part of this pull request. |
| packages/apollo-wind/src/components/ui/prompt-editor/plugins/CopyPastePlugin.tsx | Updated as part of this pull request. |
| packages/apollo-wind/src/components/ui/prompt-editor/plugins/CopyPastePlugin.test.tsx | Updated as part of this pull request. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| handled = copySelectionToClipboard( | ||
| editor, | ||
| event.clipboardData!, | ||
| selection, | ||
| codecRef.current.serialize | ||
| ); |
There was a problem hiding this comment.
Added in 7e5ef0e. Two new tests dispatch COPY_COMMAND and CUT_COMMAND with a host serializeClipboardTokens and assert the text/plain payload; the cut test also checks the editor is empty afterwards.
9a3922e to
7e5ef0e
Compare
📊 Coverage + size by packagePer-package coverage and bundle size on this PR. New-line coverage = of the source lines this PR adds or changes, the % hit by tests.
"Coverage" is each package's own |
Storybook visual diffBaseline is the deployed main Storybook, so changes merged to main after this branch was last updated can also appear here. Logs Updated (PT): Sep 24, 2026, 10:18:30 AM |


Summary
Part of MST-12952: Flow users need to keep a
{{ $vars.x }}reference as literal text in an inline-agent prompt, for example to pass one agent's prompt to another agent. Flow stores this as\{{ … }}, the same escape its expression fields already use. On load and save Flow converts between its string format and the editor's tokens, but plain-text copy/paste happens inside the prompt editor. There, any{{ … }}became a chip: the escape was ignored, and{{name}}pasted as an invalid chip.This PR lets a host supply its own clipboard string format, and makes the default paste/copy handle the
\{{escape. The Flow side will follow in a flow-workbench PR once this is released.Changes
PromptEditorpropsparseClipboardText/serializeClipboardTokens, passed toCopyPastePlugin. They replace the plain-text parse on paste and the plain text written on copy/cut. Lexical-JSON pastes between editors are unaffected. The plugin reads them through a ref, so inline callbacks don't re-register the commands.clipboardStringToTokens: the number of backslashes right before a{{decides what it is. An odd number means an escaped literal{{; an even number means literal backslashes followed by a chip. The count is halved either way. A plain\{{ … }}is therefore literal text with the backslash dropped.tokensToClipboardString: a literal{{in text is written as\{{. Backslashes right before a{{, or right before a chip, are doubled. This way any text survives a copy → paste, including text that ends in a backslash just before a chip.{{ vars.* }}into chips).Flow
flowchart TD P[Paste plain text] --> H{parseClipboardText provided?} H -- yes --> HP[Host parser] H -- no --> D[clipboardStringToTokens] D --> E{"\{{ escaped?"} E -- yes --> T[Literal text] E -- no --> C[Chip] HP --> I[Insert tokens] T --> I C --> ITesting
pnpm lintpasses (pluslint:css,lint:deps,check:dependencies)pnpm typecheckpassespnpm testpasses including the newCopyPastePlugin.test.tsx(paste, plus copy/cut with a host serializer) and serialization round-trip casespnpm test:visual: not applicable (notest:visualtasks defined)as any/ type suppressions added)