Repository navigation
fix(web): composer chips convert at the same boundaries on paste and typing - #276
Merged
Merged
Conversation
…typing Typing whitespace or a new line after an @mention, $skill or file link turns it into a chip again, as the token regexes intend. Before, typed tokens stayed text until an unrelated store rewrite rebuilt the document. A paste redirected from a blurred composer now converts issue, pull request and Slack links like a focused paste, and honours the paste-as-text shortcut for links and file paths. Co-Authored-By: Claude Opus 5.5 <[email protected]>
adampeterhiggins
force-pushed
the
ah/composer-paste-chip-triggers
branch
from
October 12, 2026 22:08
96179ec to
9fd79e5
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Text in the composer became a chip at inconsistent moments, depending on the chip kind and how the text arrived:
@mention,$skilland file links never became chips in the Tiptap editor. They stayed text until something unrelated rewrote the draft through the store (for example, a link elsewhere in the prompt turning into a chip). That rebuilt the whole document, and the earlier tokens suddenly chipped. The token regexes say a typed token becomes a chip "once a delimiter follows it", but the Tiptap editor never acted on that.Cmd+Shift+V, so file paths still became chips.Fix
chipTokenEndingAtincomposer-rich-text-doc.tsturns the token ending at the caret into its chip. It reads tokens with the same function as paste and draft rebuilds. The editor calls it when whitespace is typed, and before Enter splits the line, so typed tokens chip on a space, tab or new line, like typed links do. It skips code, styled text, literal answers, and tokens not preceded by whitespace.insertTextAtEndwith clipboard data now runs the same object-link conversion as a focused paste, at the insertion point.ChatViewpasses the paste-as-text flag through, so links and file paths stay text withCmd+Shift+V.Typed links still wait for whitespace, not for
?,.or): those characters can continue a URL (?starts a query string), so converting on them would cut links short.url?followed by a space still converts.Testing
chipTokenEndingAt: mention, skill, file link, tab, new line, caret placement, and the cases that must stay text ($20, emails,@a.ts?, bold, inline code, a token glued to a chip).vp test run apps/web/src/composer-rich-text-doc.test.ts apps/web/src/components/chat: all pass exceptOpenInPicker.test.tsxandChatMarkdown.permissions.test.tsx, which fail the same way onmain.tsc --noEmitinapps/webis clean.Surfaces: web and desktop share this editor. Mobile has its own composer and is not changed.
🤖 Generated with Claude Code (Claude Opus 5.5)