fix: use default empty content for editor

pull/24/head
fantasticit 2022-03-31 23:06:16 +08:00
parent 9fe447f88b
commit 5c84aa1211
1 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
import React, { useState, useEffect, useCallback } from 'react';
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 cls from 'classnames';
import { DEFAULT_EXTENSION, DocumentWithTitle } from 'tiptap';
@ -26,7 +26,7 @@ export const DocumentVersion: React.FC<IProps> = ({ documentId, onSelect }) => {
const editor = useEditor({
editable: false,
extensions: [...DEFAULT_EXTENSION, DocumentWithTitle],
content: {},
content: { type: 'doc', content: [] },
});
const close = useCallback(() => {
@ -75,7 +75,7 @@ export const DocumentVersion: React.FC<IProps> = ({ documentId, onSelect }) => {
header={
<div className={styles.headerWrap}>
<div>
<Button icon={<IconClose />} onClick={close} />
<Button theme="borderless" icon={<IconChevronLeft />} onClick={close} />
<Title heading={5} style={{ marginLeft: 12 }}>
</Title>