Files
andros 53c851e68d Mention autocomplete in Compose and Edit
Type `@` in the post body and a dropdown of the user's follows appears
filtered by what is typed after the `@`. Tapping a candidate inserts
`@nick ` into the editor and records `nick -> feedURL` in a mentionMap.
On publish / save the `@nick` tokens are rewritten to the spec's
`[[org-social:URL][nick]]` form before the post is serialised.

Edit sheet rounds-trips: on open the existing post body is decoded so the
user sees `@nick` instead of the raw Org link, and on save it is re-encoded.

Source of candidates:
- Follows (always; from the already-cached FollowCoordinator feed).
- All relay users (when the `showAllRelayFeeds` setting is on);
  nicks derived from the feed URL path since fetching every profile would
  be too expensive, and the exact serialised URL is always correct.

Design notes:
- SwiftUI TextEditor exposes no caret, so detection is a trailing-token
  heuristic (`@[A-Za-z0-9_.-]*$`). Mid-text mentions don't trigger the
  dropdown — acceptable since the dropdown is purely a convenience and
  manually-typed `[[org-social:URL][nick]]` still works.
- Rewrite is whole-word (`(?<!\w)@nick(?![\w.-])`), so email addresses
  and `@foo.bar` fragments that are not mapped are left alone. Longer
  nicks are replaced before shorter ones to avoid partial overlap.
- mentionOnlyWithoutMentions warning in Compose now accepts both the
  mentionMap and manually-typed `[[org-social:...]]` links as evidence
  of mentions.
2026-04-24 10:46:26 +02:00
..