mirror of https://github.com/chaitin/PandaWiki.git
Compare commits
5 Commits
feffbdf2e4
...
4623b852ee
| Author | SHA1 | Date |
|---|---|---|
|
|
4623b852ee | |
|
|
fe60e2924d | |
|
|
edb7e01085 | |
|
|
a4679f0ada | |
|
|
5e93e9da73 |
File diff suppressed because one or more lines are too long
|
|
@ -1,7 +1,7 @@
|
|||
import { DomainNodeReleaseListItem } from '@/request/pro';
|
||||
import { Modal } from '@ctzhian/ui';
|
||||
import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';
|
||||
import { Box, Stack } from '@mui/material';
|
||||
import { Modal } from '@ctzhian/ui';
|
||||
|
||||
interface VersionRollbackProps {
|
||||
open: boolean;
|
||||
|
|
@ -29,14 +29,32 @@ const VersionRollback = ({
|
|||
onOk={onOk}
|
||||
onCancel={onClose}
|
||||
>
|
||||
<Stack direction='row' spacing={2} sx={{ mb: 1, lineHeight: '24px' }}>
|
||||
<Box sx={{ fontSize: 14, width: 100 }}>版本号</Box>
|
||||
<Stack direction='row' spacing={2}>
|
||||
<Box sx={{ fontSize: 14, width: 100, flexShrink: 0 }}>版本号</Box>
|
||||
<Box sx={{ fontWeight: 700 }}>{data.release_name}</Box>
|
||||
</Stack>
|
||||
<Stack direction='row' spacing={2} sx={{ lineHeight: '24px' }}>
|
||||
<Stack direction='row' spacing={2} sx={{ mt: 2 }}>
|
||||
<Box sx={{ fontSize: 14, width: 100, flexShrink: 0 }}>版本描述</Box>
|
||||
<Box sx={{ fontSize: 14, mt: 1 }}>{data.release_message}</Box>
|
||||
<Box sx={{ fontSize: 14 }}>{data.release_message}</Box>
|
||||
</Stack>
|
||||
{data.creator_account && (
|
||||
<Stack direction='row' spacing={2} sx={{ mt: 2 }}>
|
||||
<Box sx={{ fontSize: 14, width: 100, flexShrink: 0 }}>创建人员</Box>
|
||||
<Box sx={{ fontSize: 14 }}>{data.creator_account}</Box>
|
||||
</Stack>
|
||||
)}
|
||||
{data.editor_account && (
|
||||
<Stack direction='row' spacing={2} sx={{ mt: 2 }}>
|
||||
<Box sx={{ fontSize: 14, width: 100, flexShrink: 0 }}>编辑人员</Box>
|
||||
<Box sx={{ fontSize: 14 }}>{data.editor_account}</Box>
|
||||
</Stack>
|
||||
)}
|
||||
{data.publisher_account && (
|
||||
<Stack direction='row' spacing={2} sx={{ mt: 2 }}>
|
||||
<Box sx={{ fontSize: 14, width: 100, flexShrink: 0 }}>发布人员</Box>
|
||||
<Box sx={{ fontSize: 14 }}>{data.publisher_account}</Box>
|
||||
</Stack>
|
||||
)}
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -329,6 +329,37 @@ const Wrap = ({ detail: defaultDetail }: WrapProps) => {
|
|||
/>
|
||||
</Stack>
|
||||
<Stack direction={'row'} alignItems={'center'} gap={2} sx={{ mb: 4 }}>
|
||||
{nodeDetail?.editor_account && (
|
||||
<Tooltip
|
||||
arrow
|
||||
title={
|
||||
nodeDetail?.creator_account || nodeDetail?.publisher_account ? (
|
||||
<Stack>
|
||||
{nodeDetail?.creator_account && (
|
||||
<Box>创建:{nodeDetail?.creator_account}</Box>
|
||||
)}
|
||||
{nodeDetail?.publisher_account && (
|
||||
<Box>上次发布:{nodeDetail?.publisher_account}</Box>
|
||||
)}
|
||||
</Stack>
|
||||
) : null
|
||||
}
|
||||
>
|
||||
<Stack
|
||||
direction={'row'}
|
||||
alignItems={'center'}
|
||||
gap={0.5}
|
||||
sx={{
|
||||
cursor: 'pointer',
|
||||
fontSize: 12,
|
||||
color: 'text.tertiary',
|
||||
}}
|
||||
>
|
||||
<Icon type='icon-tianjiawendang' sx={{ fontSize: 9 }} />
|
||||
{nodeDetail?.editor_account} 编辑
|
||||
</Stack>
|
||||
</Tooltip>
|
||||
)}
|
||||
<Tooltip arrow title={isEnterprise ? '查看历史版本' : ''}>
|
||||
<Stack
|
||||
direction={'row'}
|
||||
|
|
|
|||
|
|
@ -8,13 +8,14 @@ import {
|
|||
} from '@/request/pro';
|
||||
import { useAppSelector } from '@/store';
|
||||
import { Editor, useTiptap } from '@ctzhian/tiptap';
|
||||
import { Icon } from '@ctzhian/ui';
|
||||
import { Ellipsis, Icon } from '@ctzhian/ui';
|
||||
import {
|
||||
alpha,
|
||||
Box,
|
||||
Divider,
|
||||
IconButton,
|
||||
Stack,
|
||||
Tooltip,
|
||||
useTheme,
|
||||
} from '@mui/material';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
|
@ -39,6 +40,8 @@ const History = () => {
|
|||
);
|
||||
const [characterCount, setCharacterCount] = useState(0);
|
||||
|
||||
const [isMarkdown, setIsMarkdown] = useState(false);
|
||||
|
||||
const editorRef = useTiptap({
|
||||
content: '',
|
||||
editable: false,
|
||||
|
|
@ -48,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) => {
|
||||
getApiProV1NodeReleaseDetail({ id: v.id! }).then(res => {
|
||||
getApiProV1NodeReleaseDetail({ id: v.id!, kb_id: kb_id! }).then(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' });
|
||||
});
|
||||
};
|
||||
|
|
@ -166,9 +185,51 @@ const History = () => {
|
|||
<Stack
|
||||
direction={'row'}
|
||||
alignItems={'center'}
|
||||
flexWrap={'wrap'}
|
||||
gap={2}
|
||||
sx={{ mb: 4, fontSize: 12, color: 'text.tertiary' }}
|
||||
>
|
||||
{curNode.editor_account && (
|
||||
<Tooltip
|
||||
arrow
|
||||
title={
|
||||
curNode.creator_account || curNode.publisher_account ? (
|
||||
<Stack>
|
||||
{curNode.creator_account && (
|
||||
<Stack
|
||||
direction={'row'}
|
||||
alignItems={'center'}
|
||||
gap={0.5}
|
||||
>
|
||||
<Icon type='icon-chuangjian' />
|
||||
{curNode.creator_account} 创建
|
||||
</Stack>
|
||||
)}
|
||||
{curNode.publisher_account && (
|
||||
<Stack
|
||||
direction={'row'}
|
||||
alignItems={'center'}
|
||||
gap={0.5}
|
||||
>
|
||||
<Icon type='icon-fabu' />
|
||||
{curNode.publisher_account} 发布
|
||||
</Stack>
|
||||
)}
|
||||
</Stack>
|
||||
) : null
|
||||
}
|
||||
>
|
||||
<Stack
|
||||
direction={'row'}
|
||||
alignItems={'center'}
|
||||
gap={0.5}
|
||||
sx={{ cursor: 'pointer' }}
|
||||
>
|
||||
<Icon type='icon-tianjiawendang' sx={{ fontSize: 9 }} />
|
||||
{curNode.editor_account} 编辑
|
||||
</Stack>
|
||||
</Tooltip>
|
||||
)}
|
||||
<Stack direction={'row'} alignItems={'center'} gap={0.5}>
|
||||
<Icon type='icon-a-shijian2' />
|
||||
{curVersion?.release_message}
|
||||
|
|
@ -206,13 +267,6 @@ const History = () => {
|
|||
</Box>
|
||||
</Box>
|
||||
)}
|
||||
{/* <EditorThemeProvider
|
||||
colors={{ light }}
|
||||
mode='light'
|
||||
theme={{
|
||||
components: componentStyleOverrides,
|
||||
}}
|
||||
> */}
|
||||
<Box
|
||||
sx={{
|
||||
'.tiptap': {
|
||||
|
|
@ -224,9 +278,12 @@ const History = () => {
|
|||
},
|
||||
}}
|
||||
>
|
||||
<Editor editor={editorRef.editor} />
|
||||
{isMarkdown ? (
|
||||
<Editor editor={editorMdRef.editor} />
|
||||
) : (
|
||||
<Editor editor={editorRef.editor} />
|
||||
)}
|
||||
</Box>
|
||||
{/* </EditorThemeProvider> */}
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
|
|
@ -268,19 +325,39 @@ const History = () => {
|
|||
setCurVersion(item);
|
||||
}}
|
||||
>
|
||||
<Ellipsis sx={{ color: 'text.primary' }}>
|
||||
{item.release_name}
|
||||
</Ellipsis>
|
||||
<Box sx={{ fontSize: 13, color: 'text.tertiary' }}>
|
||||
{item.release_message}
|
||||
</Box>
|
||||
<Stack
|
||||
direction={'row'}
|
||||
alignItems={'center'}
|
||||
justifyContent={'space-between'}
|
||||
sx={{ mb: 1 }}
|
||||
sx={{ mt: 1, height: 21 }}
|
||||
>
|
||||
<Box
|
||||
sx={{
|
||||
color: 'text.primary',
|
||||
}}
|
||||
>
|
||||
{item.release_name}
|
||||
</Box>
|
||||
{item.publisher_account ? (
|
||||
<Stack
|
||||
direction={'row'}
|
||||
alignItems={'center'}
|
||||
gap={0.5}
|
||||
sx={{
|
||||
bgcolor: 'primary.main',
|
||||
display: 'inline-flex',
|
||||
color: 'white',
|
||||
borderRadius: '4px',
|
||||
p: 0.5,
|
||||
fontSize: 12,
|
||||
lineHeight: 1,
|
||||
}}
|
||||
>
|
||||
<Icon type='icon-fabu' />
|
||||
{item.publisher_account}
|
||||
</Stack>
|
||||
) : (
|
||||
<Box></Box>
|
||||
)}
|
||||
{curVersion?.id === item.id && (
|
||||
<Box
|
||||
sx={{
|
||||
|
|
@ -301,9 +378,6 @@ const History = () => {
|
|||
</Box>
|
||||
)}
|
||||
</Stack>
|
||||
<Box sx={{ fontSize: 13, color: 'text.tertiary' }}>
|
||||
{item.release_message}
|
||||
</Box>
|
||||
</Box>
|
||||
{idx !== list.length - 1 && <Divider sx={{ my: 0.5 }} />}
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -106,8 +106,15 @@ export interface DomainDocumentFeedbackListItem {
|
|||
|
||||
export interface DomainGetNodeReleaseDetailResp {
|
||||
content?: string;
|
||||
creator_account?: string;
|
||||
creator_id?: string;
|
||||
editor_account?: string;
|
||||
editor_id?: string;
|
||||
meta?: DomainNodeMeta;
|
||||
name?: string;
|
||||
node_id?: string;
|
||||
publisher_account?: string;
|
||||
publisher_id?: string;
|
||||
}
|
||||
|
||||
export interface DomainIPAddress {
|
||||
|
|
@ -131,11 +138,16 @@ export interface DomainNodeMeta {
|
|||
}
|
||||
|
||||
export interface DomainNodeReleaseListItem {
|
||||
creator_account?: string;
|
||||
creator_id?: string;
|
||||
editor_account?: string;
|
||||
editor_id?: string;
|
||||
id?: string;
|
||||
meta?: DomainNodeMeta;
|
||||
name?: string;
|
||||
node_id?: string;
|
||||
/** release */
|
||||
publisher_account?: string;
|
||||
publisher_id?: string;
|
||||
release_id?: string;
|
||||
release_message?: string;
|
||||
release_name?: string;
|
||||
|
|
@ -632,6 +644,7 @@ export interface GetApiProV1DocumentListParams {
|
|||
|
||||
export interface GetApiProV1NodeReleaseDetailParams {
|
||||
id: string;
|
||||
kb_id: string;
|
||||
}
|
||||
|
||||
export interface GetApiProV1NodeReleaseListParams {
|
||||
|
|
|
|||
|
|
@ -1339,6 +1339,8 @@ export interface DomainWidgetBotSettings {
|
|||
btn_logo?: string;
|
||||
btn_text?: string;
|
||||
is_open?: boolean;
|
||||
recommend_node_ids?: string[];
|
||||
recommend_questions?: string[];
|
||||
theme_mode?: string;
|
||||
}
|
||||
|
||||
|
|
@ -1579,12 +1581,18 @@ export interface V1LoginResp {
|
|||
export interface V1NodeDetailResp {
|
||||
content?: string;
|
||||
created_at?: string;
|
||||
creator_account?: string;
|
||||
creator_id?: string;
|
||||
editor_account?: string;
|
||||
editor_id?: string;
|
||||
id?: string;
|
||||
kb_id?: string;
|
||||
meta?: DomainNodeMeta;
|
||||
name?: string;
|
||||
parent_id?: string;
|
||||
permissions?: DomainNodePermissions;
|
||||
publisher_account?: string;
|
||||
publisher_id?: string;
|
||||
status?: DomainNodeStatus;
|
||||
type?: DomainNodeType;
|
||||
updated_at?: string;
|
||||
|
|
|
|||
|
|
@ -136,6 +136,8 @@ export interface NodeDetail {
|
|||
created_at: string;
|
||||
updated_at: string;
|
||||
type: 1 | 2;
|
||||
creator_account: string;
|
||||
editor_account: string;
|
||||
meta: {
|
||||
doc_width: string;
|
||||
summary: string;
|
||||
|
|
|
|||
|
|
@ -1,18 +1,17 @@
|
|||
'use client';
|
||||
|
||||
import { NodeDetail } from '@/assets/type';
|
||||
import { IconFile, IconFolder } from '@/components/icons';
|
||||
import CommentInput, {
|
||||
ImageItem,
|
||||
CommentInputRef,
|
||||
ImageItem,
|
||||
} from '@/components/commentInput';
|
||||
import { IconFile, IconFolder } from '@/components/icons';
|
||||
import { DocWidth } from '@/constant';
|
||||
import { useStore } from '@/provider';
|
||||
import {
|
||||
getShareV1CommentList,
|
||||
postShareV1Comment,
|
||||
} from '@/request/ShareComment';
|
||||
import { PhotoProvider, PhotoView } from 'react-photo-view';
|
||||
import { Editor, UseTiptapReturn } from '@ctzhian/tiptap';
|
||||
import { message } from '@ctzhian/ui';
|
||||
import { Box, Button, Divider, Stack, TextField, alpha } from '@mui/material';
|
||||
|
|
@ -22,6 +21,7 @@ import relativeTime from 'dayjs/plugin/relativeTime';
|
|||
import { useParams } from 'next/navigation';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { Controller, useForm } from 'react-hook-form';
|
||||
import { PhotoProvider, PhotoView } from 'react-photo-view';
|
||||
|
||||
dayjs.extend(relativeTime);
|
||||
dayjs.locale('zh-cn');
|
||||
|
|
@ -207,11 +207,23 @@ const DocContent = ({
|
|||
color: 'text.tertiary',
|
||||
}}
|
||||
>
|
||||
{info?.created_at && <Box>{dayjs(info?.created_at).fromNow()}创建</Box>}
|
||||
{info?.created_at && (
|
||||
<Box>
|
||||
{info?.creator_account && info?.creator_account === 'admin'
|
||||
? '管理员'
|
||||
: info?.creator_account}{' '}
|
||||
{dayjs(info?.created_at).fromNow()}创建
|
||||
</Box>
|
||||
)}
|
||||
{info?.updated_at && info.updated_at.slice(0, 1) !== '0' && (
|
||||
<>
|
||||
<Box>·</Box>
|
||||
<Box>{dayjs(info.updated_at).fromNow()}更新</Box>
|
||||
<Box>
|
||||
{info?.creator_account && info?.creator_account === 'admin'
|
||||
? '管理员'
|
||||
: info?.creator_account}{' '}
|
||||
{dayjs(info.updated_at).fromNow()}更新
|
||||
</Box>
|
||||
</>
|
||||
)}
|
||||
{!!characterCount && characterCount > 0 && (
|
||||
|
|
|
|||
Loading…
Reference in New Issue