feat(post): add post reference functionality with inline cards and suggestion search
Add support for referencing/quoting other posts within post content. Includes: - New `post_ref` segment type with `PostRefSegmentData` interface for post references - New `PostRefCard` component to display referenced posts inline - Post suggestion search triggered by `#` in `PostMentionInput` - Updated `PostContentRenderer` to render post reference segments - Add `suggestPosts` and `recordRefClick` API methods in postService Additional improvements: - Add image gallery preview for user profile covers and avatars - Make text selectable across CommentItem, PostContentRenderer, and PostDetailScreen - Migrate FlatList to FlashList in PostDetailScreen and UserProfileScreen - Add nestedScrollEnabled to CreatePostScreen - Add clickable member avatars in GroupMembersScreen
This commit is contained in:
@@ -420,6 +420,23 @@ class PostService {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
async suggestPosts(keyword: string, limit = 10): Promise<Array<{ id: string; title: string; channel?: string }>> {
|
||||
try {
|
||||
const response = await api.get<any>('/posts/suggest', { q: keyword, limit });
|
||||
return response.data ?? [];
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
async recordRefClick(sourcePostId: string, targetPostId: string): Promise<void> {
|
||||
try {
|
||||
await api.post(`/posts/${sourcePostId}/ref-click`, { target_post_id: targetPostId });
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 导出帖子服务实例
|
||||
|
||||
Reference in New Issue
Block a user