feat: 评论/帖子编辑历史与编辑标记,内容锁定
- 新增 smartDiff 差异计算与 EditHistoryModal 编辑历史弹窗,替换原 CommentEditHistoryModal - 新增 PostEditedMark 编辑标记展示 - 新增内容锁定机制(content_lock)防止并发编辑冲突 - 审核与通知服务适配
This commit is contained in:
37
frontend/components/PostEditedMark.tsx
Normal file
37
frontend/components/PostEditedMark.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import EditHistoryModal from "@/components/EditHistoryModal";
|
||||
import { apiPostHistory } from "@/lib/api";
|
||||
|
||||
/** 帖子详情「更新于」旁的编辑历史入口(登录用户可见) */
|
||||
export default function PostEditedMark({
|
||||
postId,
|
||||
currentTitle,
|
||||
currentContent,
|
||||
}: {
|
||||
postId: number;
|
||||
currentTitle: string;
|
||||
currentContent: string;
|
||||
}) {
|
||||
const [open, setOpen] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
className="cmt-edited"
|
||||
onClick={() => setOpen(true)}
|
||||
>
|
||||
编辑历史
|
||||
</button>
|
||||
<EditHistoryModal
|
||||
open={open}
|
||||
title="帖子编辑历史"
|
||||
currentTitle={currentTitle}
|
||||
currentContent={currentContent}
|
||||
fetchPage={(p, s) => apiPostHistory(postId, p, s)}
|
||||
onClose={() => setOpen(false)}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user