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 { .cloneNodeWrap {
position: absolute; position: absolute;
background-color: rgb(179 212 255 / 30%);
display: flex; display: flex;
align-items: center;
justify-content: center;
font-size: 14px; font-size: 14px;
color: #333; color: #333;
background-color: rgb(179 212 255 / 30%);
align-items: center;
justify-content: center;
user-select: none; user-select: none;
} }

View File

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

View File

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