Skip to content

Conversation

@morajabi
Copy link
Contributor

@morajabi morajabi commented Jan 7, 2026

Motivation

  • Treat email addresses as first-class rich-text entities so they do not become automatic navigable links while remaining easy to copy.
  • Detect emails on the server during markdown parsing so downstream systems receive normalized MessageEntity data.
  • Render emails in clients without converting them to navigable links, but make them copyable with a user-visible confirmation.
  • Prevent compose views from auto-converting emails to mailto: links while keeping link detection for real URLs.

Description

  • Add an NSAttributedString.Key for .emailAddress and apply it when MessageEntity.Type.email is rendered in ProcessEntities.toAttributedString, and extract it in fromAttributedString in apple/InlineUI/Sources/TextProcessing/ProcessEntities.swift.
  • Detect plain-text emails via a regex and mailto link targets during entity extraction, and stop treating mailto: as a general external link by updating allowedExternalLinkSchemes (see ProcessEntities.swift).
  • Server-side markdown parsing now recognizes email patterns via findEmails in server/src/modules/message/parseMarkdown.ts and has a corresponding test in server/src/modules/message/processText.test.ts.
  • Client UI changes: iOS UIMessageView copies an email to the clipboard and shows a toast when tapped, macOS MessageView copies email on click and shows a toast via ToastCenter, compose views suppress automatic email link conversion (dataDetectorTypes = [] on iOS and stripping mailto: links on macOS); see apple/InlineIOS/Features/Message/UIMessageView.swift, apple/InlineMac/Views/Message/MessageView.swift, apple/InlineIOS/Features/Compose/ComposeTextView.swift, and apple/InlineMac/Views/Compose/ComposeTextView.swift.

Testing

  • No automated test suite was executed as part of this change (no test runner invoked).
  • New unit tests were added for client entity handling in apple/InlineUI/Tests/InlineUITests/ProcessEntitiesTests.swift and for server markdown email parsing in server/src/modules/message/processText.test.ts, but they were not run here.
  • Changes are localized to text processing and UI tap handlers and should be covered by the added unit tests when executed in the project test runner (bun test for server and swift test for Apple packages).
  • Manual verification is recommended for iOS and macOS UI tap-to-copy + toast behavior on a local build.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants