Enhance image upload and post category features - #16
Closed
ZTZK wants to merge 3 commits into
Closed
Conversation
- files.ts: 上传接口返回绝对URL而非相对路径,解决跨端口图片加载问题 - PostDetailPageClient.tsx: 自定义img组件,处理相对/绝对URL兼容, 添加图片样式,移除rehype-sanitize避免意外过滤 - 0008 migration: 更新posts表section CHECK约束,允许新分类值 (QUESTION/OFFLINE_MEETUP/REFLECTION)
- PostForm: 新增板块选择器下拉框(提问求助/线下交友/医疗信息/资源分享/感悟) - PostForm: 图片预览改用 URL.createObjectURL (blob URL),不依赖 R2 服务 - PostForm: 移除上传文件后的预览卡片,简化 UI - Worker posts.ts: 新增 userPickedTags(),根据用户选择的 section 自动派生 tags - Worker posts.ts: create/PATCH 路由优先使用用户传入的 section,LLM 作为 fallback - Worker files.ts: 上传接口返回相对 URL (/api/files/...),跨环境可移植 - PostCard/PostDetail: 始终显示板块标签(POST_SECTION_LABEL),移除冗余 tag 徽章 - api.ts: Post 接口 section 类型补全所有板块
- PostForm: 预览模式下 ReactMarkdown 添加 img/a 自定义组件, 使用 api.files.url() 解析相对 URL,修复图片裂图和链接不可用 - PostForm: 移除预览卡片 UI,改用 编辑/预览 切换模式 - PostForm: 图片限制 5MB,附件限制 10MB - files.ts: 同步缩小限制为 5MB/10MB,修复错误提示文案
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a major refactor to how post categories ("sections") are handled, moving from a tag-based system to an explicit, user-selectable post section taxonomy. It updates the database schema, API, and UI to support new section types, improves file and attachment uploads in the post editor, and enhances the Markdown preview and rendering experience for posts.
Post Section Refactor and UI Updates:
sectionfield with options: "QUESTION", "OFFLINE_MEETUP", "MEDICAL", "RESOURCE", "REFLECTION", and legacy "POST". The database schema and API types are updated accordingly, including a migration script to enforce the new taxonomy. [1] [2] [3]PostForm) to allow users to select a section for their post. The selected section is saved and displayed throughout the UI. [1] [2] [3]Markdown Rendering and Preview Improvements:
File and Attachment Uploads:
Content and UI Copy Adjustments:
These changes modernize and clarify the post categorization system, streamline the user experience for creating and viewing posts, and lay groundwork for more flexible content organization.