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 [isMarkdown, setIsMarkdown] = useState(false);
|
||||
|
||||
const editorRef = useTiptap({
|
||||
content: '',
|
||||
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) => {
|
||||
getApiProV1NodeReleaseDetail({ id: v.id!, kb_id: kb_id! }).then(res => {
|
||||
setCurNode(res);
|
||||
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' });
|
||||
});
|
||||
};
|
||||
|
|
@ -207,7 +225,7 @@ const History = () => {
|
|||
gap={0.5}
|
||||
sx={{ cursor: 'pointer' }}
|
||||
>
|
||||
<Icon type='icon-tianjiawendang' />
|
||||
<Icon type='icon-tianjiawendang' sx={{ fontSize: 9 }} />
|
||||
{curNode.editor_account} 编辑
|
||||
</Stack>
|
||||
</Tooltip>
|
||||
|
|
@ -249,13 +267,6 @@ const History = () => {
|
|||
</Box>
|
||||
</Box>
|
||||
)}
|
||||
{/* <EditorThemeProvider
|
||||
colors={{ light }}
|
||||
mode='light'
|
||||
theme={{
|
||||
components: componentStyleOverrides,
|
||||
}}
|
||||
> */}
|
||||
<Box
|
||||
sx={{
|
||||
'.tiptap': {
|
||||
|
|
@ -267,9 +278,12 @@ const History = () => {
|
|||
},
|
||||
}}
|
||||
>
|
||||
{isMarkdown ? (
|
||||
<Editor editor={editorMdRef.editor} />
|
||||
) : (
|
||||
<Editor editor={editorRef.editor} />
|
||||
)}
|
||||
</Box>
|
||||
{/* </EditorThemeProvider> */}
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
|
|
|
|||
Loading…
Reference in New Issue