mirror of https://github.com/chaitin/PandaWiki.git
Compare commits
5 Commits
feffbdf2e4
...
4623b852ee
| Author | SHA1 | Date |
|---|---|---|
|
|
4623b852ee | |
|
|
fe60e2924d | |
|
|
edb7e01085 | |
|
|
a4679f0ada | |
|
|
5e93e9da73 |
|
|
@ -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>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue