feat: 论坛 emoji 表情支持

- 新增 dyEmoji 表情库与解析测试、EmojiPicker 选择器与 EmojiImg 组件
- Markdown 编辑器/渲染支持表情图片,新增 public/emoji 资源与生成脚本
- 聊天室与首页适配
This commit is contained in:
2026-09-28 01:28:41 +08:00
parent 2f96a36275
commit 34aee91a13
3522 changed files with 1560 additions and 251 deletions

View File

@@ -2,6 +2,7 @@ import type { ReactNode } from "react";
import type { Components } from "react-markdown";
import { renderMarkdownToReact } from "@/components/markdown/renderMarkdown";
import { splitContentSegments } from "@/lib/directiveBlocks";
import { expandDyEmojiShortcodes } from "@/lib/dyEmoji";
import type { HideKind } from "@/lib/hideBlocks";
import MdHideBlock from "@/components/markdown/MdHideBlock";
import MdTimeline from "@/components/markdown/MdTimeline";
@@ -28,7 +29,7 @@ export default async function MarkdownBody({
loginHref,
loggedIn = false,
}: MarkdownBodyProps) {
const segs = splitContentSegments(content || "");
const segs = splitContentSegments(expandDyEmojiShortcodes(content || ""));
const nodes = [];
for (let i = 0; i < segs.length; i++) {
const seg = segs[i];
@@ -48,7 +49,7 @@ export default async function MarkdownBody({
continue;
}
// 条目正文不挂目录 id,避免与块外 headingRenderer 错位
bodies.push(await renderMarkdownToReact(it.body));
bodies.push(await renderMarkdownToReact(expandDyEmojiShortcodes(it.body)));
}
nodes.push(
<MdTimeline
@@ -75,7 +76,7 @@ export default async function MarkdownBody({
continue;
}
const inner = seg.body.trim()
? await renderMarkdownToReact(seg.body)
? await renderMarkdownToReact(expandDyEmojiShortcodes(seg.body))
: null;
nodes.push(
<MdHideBlock key={`hide-${i}`} kind={kind} points={seg.points}>