Skip to content

feat: Paste images in ticket comments (#308)#313

Open
akash2017sky wants to merge 9 commits intomainfrom
feat/issue-308-paste-images-comments
Open

feat: Paste images in ticket comments (#308)#313
akash2017sky wants to merge 9 commits intomainfrom
feat/issue-308-paste-images-comments

Conversation

@akash2017sky
Copy link
Copy Markdown
Collaborator

@akash2017sky akash2017sky commented Mar 18, 2026

Summary

  • Paste images directly into the comment input using Ctrl+V / Cmd+V — images render inline like Zendesk
  • MentionInput converted from textarea to contentEditable div for rich content support
  • Images auto-upload as Azure DevOps attachments and embed via proxy URL
  • New attachment proxy route (/api/devops/attachments/[id]) serves files with authentication
  • Inline image CSS for comments and descriptions

Key Changes

  • src/components/common/MentionInput.tsx — Rewritten as contentEditable div with @mention support preserved
  • src/components/tickets/TicketDetail.tsx — Paste handler uploads images and inserts inline <img> tags
  • src/app/api/devops/attachments/[id]/route.ts — New proxy route for authenticated attachment serving
  • src/app/globals.css — Inline image styling for user content

Screenshot

image

Test plan

  • Paste screenshot (Win+Shift+S) into comment input — image renders inline
  • Submit comment with inline image — image visible in comment thread
  • @mention suggestions still work in the new contentEditable input
  • Plain text paste (Ctrl+V) still works normally
  • Image also appears as attachment on the ticket in Azure DevOps

Closes #308

🤖 Generated with Claude Code

akash2017sky and others added 2 commits March 18, 2026 14:33
- Intercept paste events on comment textarea for clipboard images
- Auto-upload pasted images as attachments to Azure DevOps
- Insert inline <img> tag into comment for Azure DevOps HTML rendering
- Show thumbnail previews of pasted images with remove button
- Loading indicator while image uploads
- Updated MentionInput with onPaste prop support

Closes #308

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Convert MentionInput from textarea to contentEditable div for inline image rendering
- Pasted images upload as attachments and render inline in the comment input
- Add attachment proxy route (/api/devops/attachments/[id]) for authenticated image serving
- Add CSS for inline images in user content (comments, descriptions)
- Images display inline in both the comment input and the comment thread after submit

Closes #308

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for pasting images into ticket comments by switching the mention/comment input to a contentEditable editor, uploading pasted images as Azure DevOps attachments, and rendering them inline via a new authenticated attachment proxy route.

Changes:

  • Rewrites MentionInput to a contentEditable-based editor while preserving @mention suggestions.
  • Adds paste-image handling in the ticket reply box to auto-upload and insert inline <img> tags.
  • Introduces /api/devops/attachments/[id] proxy route and global CSS to style inline images in user-generated HTML.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
src/components/tickets/TicketDetail.tsx Adds image paste upload flow and inserts inline <img> tags into comment content.
src/components/common/MentionInput.tsx Converts textarea to contentEditable; adds paste handling and HTML/text syncing for mentions + images.
src/app/api/devops/attachments/[id]/route.ts New server route to fetch/serve DevOps attachments using the user session token.
src/app/globals.css Adds styling for inline images inside .user-content.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

akash2017sky and others added 4 commits March 18, 2026 18:48
- Escape img src/alt attributes and validate URLs in getTextContent
- Sanitize innerHTML sync with whitelisted img tags only (XSS prevention)
- Remove debug console.log from paste handler
- Always preventDefault on paste to block arbitrary HTML injection
- Include org in attachment proxy URL for multi-org support
- Sanitize filename in Content-Disposition header (strip control chars)
- Stream attachment response body instead of buffering, add size limit

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Replace textarea with MentionInput in CommentSection for paste support
- Add onUploadAttachment prop chain: Dialog -> Content -> CommentSection
- Dialog now handles attachment uploads for pasted images
- Images render inline in the dialog comment input

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Replace description textarea with MentionInput for inline image paste
- Pasted images converted to base64 data URLs and embedded in description
- Images render inline in the description input while composing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@akash2017sky akash2017sky self-assigned this Mar 19, 2026
@EdiWeeks EdiWeeks assigned EdiWeeks and unassigned akash2017sky Mar 20, 2026
@EdiWeeks
Copy link
Copy Markdown
Collaborator

EdiWeeks commented Mar 20, 2026

@akash2017sky , please take a look of this issue: #324
There is a problem when pasting image in full view, the buttons are not visible (Zap, Send)

@EdiWeeks EdiWeeks assigned akash2017sky and unassigned EdiWeeks Mar 23, 2026
akash2017sky and others added 2 commits March 23, 2026 11:55
…en (#324)

- Add max-h-[300px] and overflow-auto to comment MentionInput
- Remove hardcoded minHeight from MentionInput inline style
- Pasted images now scroll within the input instead of pushing buttons off screen

Fixes #324

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…-comments

Keep onUploadAttachment prop and TypeChangeRequiredFields modal.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@akash2017sky
Copy link
Copy Markdown
Collaborator Author

Resolved merge conflict with main — kept both image paste support (onUploadAttachment) and TypeChangeRequiredFields modal from main. PR should now be mergeable.

…-comments

Keep both paste-image functionality (from this branch) and resolution editing
support (from main) in TicketDetail and WorkItemDetailContent components.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Ability to copy and paste images in comment

3 participants