tiptap: remove unused code

This commit is contained in:
fantasticit 2022-04-27 22:25:01 +08:00
parent 733a4910e9
commit 6d0a596496
5 changed files with 45 additions and 49 deletions

View File

@ -8,12 +8,12 @@
.cloneNodeWrap {
position: absolute;
background-color: rgb(179 212 255 / 30%);
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
color: #333;
background-color: rgb(179 212 255 / 30%);
align-items: center;
justify-content: center;
user-select: none;
}

View File

@ -1,6 +1,6 @@
import { useEffect, useRef } from 'react';
import cls from 'classnames';
import { NodeViewWrapper, NodeViewContent } from '@tiptap/react';
import { NodeViewWrapper } from '@tiptap/react';
import { Button, Typography, Spin, Collapsible, Space } from '@douyinfe/semi-ui';
import { IconDownload, IconPlayCircle, IconClose } from '@douyinfe/semi-icons';
import { Tooltip } from 'components/tooltip';
@ -68,47 +68,45 @@ export const AttachmentWrapper = ({ editor, node, updateAttributes }) => {
if (url) {
return (
<>
<div className={cls(styles.wrap, visible && styles.isPreviewing, 'render-wrapper')} onClick={selectFile}>
<div>
<Space>
{getFileTypeIcon(fileType)}
<Text
style={{ marginLeft: 8 }}
ellipsis={{
showTooltip: { opts: { content: `${fileName}.${fileExt}`, style: { wordBreak: 'break-all' } } },
}}
>
{fileName}.{fileExt}
<Text type="tertiary">({normalizeFileSize(fileSize)})</Text>
</Text>
</Space>
<span>
<Tooltip content={!visible ? '预览' : '收起'}>
<Button
theme={'borderless'}
type="tertiary"
icon={!visible ? <IconPlayCircle /> : <IconClose />}
onClick={toggleVisible}
/>
</Tooltip>
<Tooltip content="下载">
<Button
theme={'borderless'}
type="tertiary"
icon={<IconDownload />}
onClick={() => download(url, name)}
/>
</Tooltip>
</span>
</div>
{url ? (
<Collapsible isOpen={visible}>
<Player fileType={fileType} url={url} />
</Collapsible>
) : null}
<div className={cls(styles.wrap, visible && styles.isPreviewing, 'render-wrapper')} onClick={selectFile}>
<div>
<Space>
{getFileTypeIcon(fileType)}
<Text
style={{ marginLeft: 8 }}
ellipsis={{
showTooltip: { opts: { content: `${fileName}.${fileExt}`, style: { wordBreak: 'break-all' } } },
}}
>
{fileName}.{fileExt}
<Text type="tertiary">({normalizeFileSize(fileSize)})</Text>
</Text>
</Space>
<span>
<Tooltip content={!visible ? '预览' : '收起'}>
<Button
theme={'borderless'}
type="tertiary"
icon={!visible ? <IconPlayCircle /> : <IconClose />}
onClick={toggleVisible}
/>
</Tooltip>
<Tooltip content="下载">
<Button
theme={'borderless'}
type="tertiary"
icon={<IconDownload />}
onClick={() => download(url, name)}
/>
</Tooltip>
</span>
</div>
</>
{url ? (
<Collapsible isOpen={visible}>
<Player fileType={fileType} url={url} />
</Collapsible>
) : null}
</div>
);
}

View File

@ -1,4 +1,4 @@
import { NodeViewWrapper, NodeViewContent } from '@tiptap/react';
import { NodeViewWrapper } from '@tiptap/react';
import { useMemo, useCallback, useEffect, useRef } from 'react';
import cls from 'classnames';
import { Popover, TextArea, Typography, Space } from '@douyinfe/semi-ui';

View File

@ -1,7 +1,7 @@
import { NodeViewWrapper } from '@tiptap/react';
import { Spin } from '@douyinfe/semi-ui';
export const LoadingWrapper = ({ editor, node, updateAttributes }) => {
export const LoadingWrapper = ({ editor, node }) => {
const isEditable = editor.isEditable;
const { text } = node.attrs;

View File

@ -1,4 +1,4 @@
import { NodeViewWrapper, NodeViewContent } from '@tiptap/react';
import { NodeViewWrapper } from '@tiptap/react';
import { Button, Collapsible, Space, Popover, Tag, Input } from '@douyinfe/semi-ui';
import cls from 'classnames';
import { useCallback, useEffect, useRef } from 'react';
@ -90,7 +90,6 @@ export const StatusWrapper = ({ editor, node, updateAttributes }) => {
return (
<NodeViewWrapper as="span" className={cls(styles.wrap, 'status')}>
<NodeViewContent />
{isEditable ? (
<Popover
showArrow
@ -130,7 +129,6 @@ export const StatusWrapper = ({ editor, node, updateAttributes }) => {
) : (
content
)}
<NodeViewContent />
</NodeViewWrapper>
);
};