mirror of https://github.com/fantasticit/think.git
fix: use default empty content for editor
This commit is contained in:
parent
9fe447f88b
commit
5c84aa1211
|
@ -1,6 +1,6 @@
|
||||||
import React, { useState, useEffect, useCallback } from 'react';
|
import React, { useState, useEffect, useCallback } from 'react';
|
||||||
import { Button, Modal, Typography } from '@douyinfe/semi-ui';
|
import { Button, Modal, Typography } from '@douyinfe/semi-ui';
|
||||||
import { IconClose } from '@douyinfe/semi-icons';
|
import { IconChevronLeft } from '@douyinfe/semi-icons';
|
||||||
import { useEditor, EditorContent } from '@tiptap/react';
|
import { useEditor, EditorContent } from '@tiptap/react';
|
||||||
import cls from 'classnames';
|
import cls from 'classnames';
|
||||||
import { DEFAULT_EXTENSION, DocumentWithTitle } from 'tiptap';
|
import { DEFAULT_EXTENSION, DocumentWithTitle } from 'tiptap';
|
||||||
|
@ -26,7 +26,7 @@ export const DocumentVersion: React.FC<IProps> = ({ documentId, onSelect }) => {
|
||||||
const editor = useEditor({
|
const editor = useEditor({
|
||||||
editable: false,
|
editable: false,
|
||||||
extensions: [...DEFAULT_EXTENSION, DocumentWithTitle],
|
extensions: [...DEFAULT_EXTENSION, DocumentWithTitle],
|
||||||
content: {},
|
content: { type: 'doc', content: [] },
|
||||||
});
|
});
|
||||||
|
|
||||||
const close = useCallback(() => {
|
const close = useCallback(() => {
|
||||||
|
@ -75,7 +75,7 @@ export const DocumentVersion: React.FC<IProps> = ({ documentId, onSelect }) => {
|
||||||
header={
|
header={
|
||||||
<div className={styles.headerWrap}>
|
<div className={styles.headerWrap}>
|
||||||
<div>
|
<div>
|
||||||
<Button icon={<IconClose />} onClick={close} />
|
<Button theme="borderless" icon={<IconChevronLeft />} onClick={close} />
|
||||||
<Title heading={5} style={{ marginLeft: 12 }}>
|
<Title heading={5} style={{ marginLeft: 12 }}>
|
||||||
版本记录
|
版本记录
|
||||||
</Title>
|
</Title>
|
||||||
|
|
Loading…
Reference in New Issue