Repository navigation
feat(markdown): 图片图注 + 点击全屏预览 - #34
Merged
Merged
Conversation
- 移除 alt 悬停气泡:img 与 alt 图注包进 .md-figure 卡片,图注在图片下方居中 - 新增 MarkdownImagePreview:document 事件委托点击图片全屏预览,点图片外空白或 Esc 退出 - 预览优先于 Markdown 链接跳转;空 alt 只渲染图片不渲染图注,图注宽度跟随图片 - 单测覆盖图注渲染、转义、空 alt 与预览开/关路径
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.
变更
替代 #32 的 alt 悬停气泡(主人反馈效果不理想,改为图注 + 预览)。
frontend/src/lib/markdown.ts:的 img 与 alt 图注包进.md-figure卡片;alt 为空只渲染图片、不渲染图注。frontend/src/md-content.css:移除 hover 气泡样式,新增卡片盒子(边框 + 深色底 + 虚线分隔),图注在图片下方居中、宽度跟随图片。frontend/src/components/MarkdownImagePreview.tsx:document 事件委托,点击 Markdown 图片全屏预览;预览层只显示图片,点图片外空白或按 Esc 退出,打开时锁定页面滚动;图片包在链接里时预览优先。frontend/src/App.tsx:预览组件挂根节点,覆盖 C 端与 B 端 markdown 渲染容器。验证
npx tsc -b通过npx vitest run:22 个文件 / 127 条用例全绿