Compare commits

..

5 Commits

Author SHA1 Message Date
holly 4623b852ee
Merge fe60e2924d into d630567a3c 2025-11-05 10:55:34 +08:00
yu.kuai fe60e2924d fix: 发布人员 icon 调整大小 2025-11-05 10:55:26 +08:00
yu.kuai edb7e01085 feat: 历史版本展示 markdown 文本 2025-11-05 10:40:41 +08:00
yu.kuai a4679f0ada feat: 前台支持展示更新人/创建人 2025-11-05 10:40:41 +08:00
yu.kuai 5e93e9da73 feat: 文档显示人员操作记录 2025-11-05 10:40:41 +08:00
1 changed files with 25 additions and 11 deletions

View File

@ -40,6 +40,8 @@ const History = () => {
); );
const [characterCount, setCharacterCount] = useState(0); const [characterCount, setCharacterCount] = useState(0);
const [isMarkdown, setIsMarkdown] = useState(false);
const editorRef = useTiptap({ const editorRef = useTiptap({
content: '', content: '',
editable: false, editable: false,
@ -49,10 +51,26 @@ const History = () => {
}, },
}); });
const editorMdRef = useTiptap({
content: '',
contentType: 'markdown',
editable: false,
immediatelyRender: true,
onUpdate: ({ editor }) => {
setCharacterCount((editor.storage as any).characterCount.characters());
},
});
const getDetail = (v: DomainNodeReleaseListItem) => { const getDetail = (v: DomainNodeReleaseListItem) => {
getApiProV1NodeReleaseDetail({ id: v.id!, kb_id: kb_id! }).then(res => { getApiProV1NodeReleaseDetail({ id: v.id!, kb_id: kb_id! }).then(res => {
setCurNode(res); setCurNode(res);
editorRef.setContent(res.content || ''); if (res.meta?.content_type === 'md') {
setIsMarkdown(true);
editorMdRef.setContent(res.content || '');
} else {
setIsMarkdown(false);
editorRef.setContent(res.content || '');
}
window.scrollTo({ top: 0, behavior: 'smooth' }); window.scrollTo({ top: 0, behavior: 'smooth' });
}); });
}; };
@ -207,7 +225,7 @@ const History = () => {
gap={0.5} gap={0.5}
sx={{ cursor: 'pointer' }} sx={{ cursor: 'pointer' }}
> >
<Icon type='icon-tianjiawendang' /> <Icon type='icon-tianjiawendang' sx={{ fontSize: 9 }} />
{curNode.editor_account} {curNode.editor_account}
</Stack> </Stack>
</Tooltip> </Tooltip>
@ -249,13 +267,6 @@ const History = () => {
</Box> </Box>
</Box> </Box>
)} )}
{/* <EditorThemeProvider
colors={{ light }}
mode='light'
theme={{
components: componentStyleOverrides,
}}
> */}
<Box <Box
sx={{ sx={{
'.tiptap': { '.tiptap': {
@ -267,9 +278,12 @@ const History = () => {
}, },
}} }}
> >
<Editor editor={editorRef.editor} /> {isMarkdown ? (
<Editor editor={editorMdRef.editor} />
) : (
<Editor editor={editorRef.editor} />
)}
</Box> </Box>
{/* </EditorThemeProvider> */}
</Box> </Box>
)} )}
</Box> </Box>