Repository navigation
Link selected text in comments with Cmd+K or by pasting a URL - #298
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The link command and paste handler do not escape Markdown delimiters in labels and URLs, which can break links or truncate valid destinations.
1 open issue
What changed in this PR
Adds Markdown link creation to CoPlan’s shared comment composer using Cmd/Ctrl+K or by pasting a URL over selected text.
Changes:
- Adds link insertion with browser undo support and an empty-label option.
- Wires keyboard and paste actions into the shared composer and documents them in shortcut help.
- Adds system coverage for insertion, undo/redo, cancellation, paste handling, and posted links.
| File | Description |
|---|---|
spec/system/comment_composer_links_spec.rb |
Tests link creation and related composer behavior. |
engine/config/keyboard_shortcuts.json |
Lists link shortcuts under writing comments. |
engine/app/views/coplan/comment_threads/_composer_fields.html.erb |
Binds keyboard and paste events to link handlers. |
engine/app/javascript/controllers/coplan/comment_form_controller.js |
Implements URL prompting, paste-to-link, and undo-aware insertion. |
Review effort: Balanced
|
🤖 @codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0ea4cec012
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
🤖 Cleanup pushed in 03966ec: Cmd/Ctrl+K and paste-to-link now share Markdown escaping for label brackets/backslashes and destination parentheses/backslashes. The two bot findings described the same defect; both are answered and resolved. Validation: six new rendered-link browser regressions failed before the fix and pass after it. The complete composer-link and Markdown-helper selection passes (55 examples); targeted RuboCop and diff checks pass. Verified posted comments/replies in the shared demo in light and dark themes. All 15 current-head checks are green, including MySQL/PostgreSQL suites, all browser groups, all stress runs, lint, security scans, and DCO. The final local code review found no additional escaping defects. GitHub reports conflict-free/MERGEABLE and REVIEW_REQUIRED: the remaining merge gate is one approving review with code-owner coverage. No merge has been performed. Agent recommendation: accept the small, dependency-free link shortcut feature after final verification and product review. It supports CoPlan's central comment workflow and keeps undo intact. UX limitation for Hampton to consider: Cmd+K uses a blocking browser prompt; Chrome system tests pass, but Codex's embedded browser rejects prompt(), while paste-to-link works there. An in-app URL field would improve compatibility and consistency; this focused escaping patch does not redesign that interaction. |
|
🤖 Implemented @HamptonMakes's requested pre-shipping fix: Cmd+K must work inside the in-app browser, not silently fail on an unsupported browser prompt. The composer now shows a server-rendered Link URL field in place. Opening it preserves the draft selection and window geometry; Enter or Insert link inserts without posting, and Escape or Cancel link restores the unchanged draft and focus. The same shared control works in new comments, replies, and edits. Undo/redo and Markdown escaping remain intact. Invalid URLs receive inline feedback. Pending mention searches are cancelled when opening the URL field. Added a named “Comments: link selected text” scenario to the shared demo library, with reseeding coverage, and updated the served comment instructions. Verified the exact Validation: the final composer-link/source-comment run passes all 38 examples; the broader composer and agent-instructions checks also passed, as did seed/reseed checks, targeted RuboCop, and diff checks. Current-head CI and a fresh Codex review are being checked before the final readiness report. No merge performed. 🤖 @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b37f9883fa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
🤖 Completed the pre-shipping fixes requested by @HamptonMakes. Cmd+K/Ctrl+K now opens an in-composer URL field that works in the embedded browser. Enter inserts without posting; Escape/Cancel restores the draft; closing and reopening the composer clears link-entry mode without losing the draft. Invalid URLs and drafts changed by dictation show actionable feedback. Head: Validation: 123 relevant specs passed after integrating main; final link/source-comment regression run passed all 42 examples; checkbox/link coverage passed 27 examples; navigation coverage passed 3 examples. Focused demo seed/reseed checks, lint, and whitespace checks pass. Verified the interaction in the embedded browser in light and dark themes. All four review threads are resolved. Preview: http://localhost:3298/hampton/demo-content/rich-text/comments-link-selected-text — refresh once, add a comment, select Final gate: all 15 CI checks pass on |
|
🤖 @codex review @HamptonMakes requested that Cmd+K keep the comment visible, offer search for content on the site, and accept application URIs such as The link picker now floats beside/above the visible draft, searches authorized plans and people, supports keyboard result selection, and inserts without navigating or posting. Paste-over-selection still works, including application URIs. The shared Markdown sanitizer preserves application links on anchors while retaining HTML/image sanitization and excluding executable URL schemes. The named demo and served composer guide describe the new behavior. Local validation: 107 composer/source-comment/rendering/search checks passed; seed/reseed and agent-guide checks passed; the final keyboard-search and sanitizer regression checks passed. Light/dark embedded-browser tryouts verified visible drafts and working search/URI insertion. CI and fresh automated review are pending on this head; merge conflicts are resolved. No approval or merge performed. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e9929c771a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Mod+K in a comment, reply or edit textarea prompts for a URL with the document editor's prompt and validation, then writes [selection](url), or [](url) with the caret between the brackets when nothing is selected. Pasting a single http(s) or mailto URL over a selection links it. Edits go through insertText so Cmd+Z undoes them and input listeners (mentions, dictation) stay in sync. Both appear in the shortcut help. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Ctrl+Z and Ctrl+Y don't undo or redo in Chrome on macOS, so the spec would fail on Mac development machines. Use Cmd there, like the other editor specs, and Mod+Shift+Z for redo on both platforms. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Hampton Lintorn-Catlin <hampton@squareup.com>
Signed-off-by: Hampton Lintorn-Catlin <hampton@squareup.com>
Signed-off-by: Hampton Lintorn-Catlin <hampton@squareup.com>
Signed-off-by: Hampton Lintorn-Catlin <hampton@squareup.com>
Signed-off-by: Hampton Lintorn-Catlin <hampton@squareup.com>
Signed-off-by: Hampton Lintorn-Catlin <hampton@squareup.com>
Signed-off-by: Hampton Lintorn-Catlin <hampton@squareup.com>
e9929c7 to
1e52528
Compare
|
🤖 Rebased at @HamptonMakes' request onto current main ( Fixed Codex finding 4494248246 in After rebase: 143 relevant examples pass, including the full theme spec, comment/source-comment flows, search authorization, URI sanitization, and cache invalidation. Lint and whitespace checks pass. The earlier CI failure was Net::ReadTimeout at The preview is running at http://localhost:3298/hampton/demo-content/rich-text/comments-link-selected-text and has been checked after rebase. Existing light/dark picker evidence is in the preceding cleanup comment. No approval or merge performed. Final result: all 15 CI checks passed on |
Signed-off-by: Hampton Lintorn-Catlin <hampton@squareup.com>
|
🤖 Merged current main ( Validation: 96 focused helper, sanitizer, request, and comment-link browser examples passed; lint and diff checks passed. All 15 GitHub checks are green on Rechecked the running preview in Chrome: the floating ⌘K picker keeps the draft visible, and selecting |
|
🤖 Post-merge verification and release-note evidence Merged as b40c2c3 on November 9 at 18:04 UTC. Post-merge CI completed successfully: all 12 jobs passed, covering lint, MySQL/PostgreSQL suites, browser shards, and browser stress runs. Release note: Link selected text in comments with ⌘K (Ctrl+K) using a floating picker that keeps your draft visible. Search Coplan plans and people or paste a URI, including application links such as Evidence: feature review and light/dark checks, integration checks and preview verification. Contributor: @arielahdoot. This confirms the code is merged; it does not claim a gem release or deployment. No remaining human action or follow-up in this chat. The existing local preview is preserved at http://localhost:3298/hampton/demo-content/rich-text/comments-link-selected-text . |










Tried this out in the new-comment, reply, and edit composers, in light and dark themes, with a second person watching the same document.
codex://. Selecting a result or inserting the URI adds[text](uri)without posting. Undo and redo work.[](url)with the cursor in the label.