Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

feat(message-editor): double paste to undo chip auto-conversion - #3454

Merged
charlesvien merged 10 commits into
mainfrom
feat/double-paste-as-text
Jul 15, 2026
Merged

feat(message-editor): double paste to undo chip auto-conversion#3454
charlesvien merged 10 commits into
mainfrom
feat/double-paste-as-text

Conversation

@charlesvien

@charlesvien charlesvien commented Jul 14, 2026

Copy link
Copy Markdown
Member

Problem

Pasting a GitHub issue/PR URL or long text into the composer auto-converts it to a chip. When you wanted the raw text instead, undoing that means knowing about Cmd+Shift+V ahead of time.

Changes

Pasting the same clipboard again right after an auto-conversion now replaces the chip with the plain text. Covers GitHub ref chips and long-text attachment chips. A repeat paste that lands before the text finishes persisting inserts the text immediately at the paste position instead of waiting on the file write. It only fires while the caret still follows the chip, so typing or moving the caret between pastes keeps normal paste behavior.

Double paste is now the only un-convert path: the click-to-convert behavior on pasted-text chips is removed and their tooltip says "Paste again to expand as text".

Pasted text chip with tooltip

The first-time hint toast teaches the gesture and can be acknowledged with "Got it" to never show again (it also stops once the user double-pastes, or after 3 showings):

Paste hint toast with Got it action

After pasting the same clipboard again, the chip expands back to the raw text:

Expanded text after double paste

How did you test this?

  • Drove the dev app over CDP: pasted a GitHub issue URL twice (chip, then plain URL), long text twice (chip, then inline text), a zero-delay double paste (text appears immediately, single copy, no orphaned chip), typed between pastes (two chips, no un-convert), clicked a pasted-text chip (inert, no conversion), hovered the chip (tooltip shows "Paste again to expand as text") and triggered the paste hint toast (renders with a working "Got it" action).
  • Unit tests for the repeat-paste predicate in @posthog/core (paste.test.ts).
  • pnpm typecheck and biome lint packages/core (zero noRestrictedImports).

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

@trunk-io

trunk-io Bot commented Jul 14, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit fb99fd2.

@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "double paste to undo chip auto-conversio..." | Re-trigger Greptile

Comment thread packages/ui/src/features/message-editor/tiptap/useTiptapEditor.ts Outdated
Comment thread packages/ui/src/features/message-editor/tiptap/useTiptapEditor.ts Outdated
@charlesvien charlesvien added the Stamphog This will request an autostamp by stamphog on small changes label Jul 14, 2026
github-actions[bot]
github-actions Bot previously approved these changes Jul 14, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Focused UX feature replacing click-to-undo with double-paste for chip auto-conversion. Race conditions are handled correctly: the cancel path dispatches text synchronously rather than waiting for persistence, and the chipId-based doc walk correctly guards against stale undos. Both bot comments are resolved and the analysis confirms the code addresses them.

@github-actions
github-actions Bot dismissed their stale review July 14, 2026 23:05

New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.

github-actions[bot]
github-actions Bot previously approved these changes Jul 14, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No showstoppers. The chipId attribute was already in the node schema; the race-condition handling via the canceled flag is correct given JS's single-threaded event loop; the doc-walk caret guard prevents stale undos; and both bot concerns are properly addressed in the current diff.

@github-actions
github-actions Bot dismissed their stale review July 14, 2026 23:10

New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.

github-actions[bot]
github-actions Bot previously approved these changes Jul 14, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No showstoppers. The chipId attribute was pre-existing in the node schema, the canceled-flag race handling is correct for JS's single-threaded event loop, and the caret guard prevents stale undo. Both bot comments are genuinely resolved in the current diff.

@github-actions
github-actions Bot dismissed their stale review July 15, 2026 00:18

New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean UX feature replacing click-to-undo with double-paste for chip auto-conversion. Both bot-raised concerns (async race on canceled paste, rich-text insertText) are correctly addressed in the diff. Architecture is sound, tests cover the new utility modules, and the canceled-flag state machine is correct for JS's single-threaded event model.

@charlesvien
charlesvien merged commit c9ad48b into main Jul 15, 2026
27 checks passed
@charlesvien
charlesvien deleted the feat/double-paste-as-text branch July 15, 2026 00:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Stamphog This will request an autostamp by stamphog on small changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant