From f24b00a6ec5994ac0cfa753bce3a05524b633204 Mon Sep 17 00:00:00 2001 From: fantasticit Date: Sun, 5 Jun 2022 19:33:22 +0800 Subject: [PATCH] tiptap: add title --- .../core/wrappers/flow/index.module.scss | 22 +++++++++- .../src/tiptap/core/wrappers/flow/index.tsx | 40 +++++++------------ .../core/wrappers/mind/index.module.scss | 22 +++++++++- .../src/tiptap/core/wrappers/mind/index.tsx | 31 +++++++------- 4 files changed, 68 insertions(+), 47 deletions(-) diff --git a/packages/client/src/tiptap/core/wrappers/flow/index.module.scss b/packages/client/src/tiptap/core/wrappers/flow/index.module.scss index 696f61c7..bb54d57b 100644 --- a/packages/client/src/tiptap/core/wrappers/flow/index.module.scss +++ b/packages/client/src/tiptap/core/wrappers/flow/index.module.scss @@ -20,10 +20,28 @@ } } + .title { + position: absolute; + top: 10px; + left: 10px; + z-index: 2; + + .icon { + display: flex; + width: 18px; + height: 18px; + color: #fff; + background-color: #f80; + border-radius: 2px; + justify-content: center; + align-items: center; + } + } + .toolbarWrap { position: absolute; - right: 20px; - bottom: 20px; + right: 10px; + bottom: 10px; z-index: 2; display: flex; padding: 2px 4px; diff --git a/packages/client/src/tiptap/core/wrappers/flow/index.tsx b/packages/client/src/tiptap/core/wrappers/flow/index.tsx index 3e9523fc..1b2a8572 100644 --- a/packages/client/src/tiptap/core/wrappers/flow/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/flow/index.tsx @@ -1,7 +1,7 @@ import { Button, Space, Spin, Typography } from '@douyinfe/semi-ui'; import { NodeViewWrapper } from '@tiptap/react'; import cls from 'classnames'; -import { IconMindCenter, IconZoomIn, IconZoomOut } from 'components/icons'; +import { IconFlow, IconMindCenter, IconZoomIn, IconZoomOut } from 'components/icons'; import { Resizeable } from 'components/resizeable'; import { useToggle } from 'hooks/use-toggle'; import { useCallback, useEffect, useRef, useState } from 'react'; @@ -13,7 +13,6 @@ import styles from './index.module.scss'; const { Text } = Typography; const INHERIT_SIZE_STYLE = { width: '100%', height: '100%', maxWidth: '100%' }; -const ICON_STYLE = { fontSize: '0.85em' }; export const FlowWrapper = ({ editor, node, updateAttributes }) => { const isEditable = editor.isEditable; @@ -22,7 +21,7 @@ export const FlowWrapper = ({ editor, node, updateAttributes }) => { const { data, width, height } = node.attrs; const $graph = useRef(null); const $container = useRef(); - const [bgColor, setBgColor] = useState('var(--semi-color-fill-0)'); + const [bgColor, setBgColor] = useState('var(--semi-color-bg-3)'); const [loading, toggleLoading] = useToggle(true); const [error, setError] = useState(null); @@ -103,31 +102,20 @@ export const FlowWrapper = ({ editor, node, updateAttributes }) => { {!loading && !error &&
} +
+ + + + + 流程图 + +
+
-
diff --git a/packages/client/src/tiptap/core/wrappers/mind/index.module.scss b/packages/client/src/tiptap/core/wrappers/mind/index.module.scss index 5f12d133..a94678cd 100644 --- a/packages/client/src/tiptap/core/wrappers/mind/index.module.scss +++ b/packages/client/src/tiptap/core/wrappers/mind/index.module.scss @@ -13,10 +13,28 @@ } } + .title { + position: absolute; + top: 10px; + left: 10px; + z-index: 2; + + .icon { + display: flex; + width: 18px; + height: 18px; + color: #fff; + background-color: #f80; + border-radius: 2px; + justify-content: center; + align-items: center; + } + } + .mindHandlerWrap { position: absolute; - right: 20px; - bottom: 20px; + right: 10px; + bottom: 10px; z-index: 2; padding: 2px 4px; background-color: var(--semi-color-bg-2); diff --git a/packages/client/src/tiptap/core/wrappers/mind/index.tsx b/packages/client/src/tiptap/core/wrappers/mind/index.tsx index 0411b5a2..4dd7e991 100644 --- a/packages/client/src/tiptap/core/wrappers/mind/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/mind/index.tsx @@ -1,7 +1,7 @@ -import { Button, Spin, Typography } from '@douyinfe/semi-ui'; +import { Button, Space, Spin, Typography } from '@douyinfe/semi-ui'; import { NodeViewWrapper } from '@tiptap/react'; import cls from 'classnames'; -import { IconMindCenter, IconZoomIn, IconZoomOut } from 'components/icons'; +import { IconMind, IconMindCenter, IconZoomIn, IconZoomOut } from 'components/icons'; import { Resizeable } from 'components/resizeable'; import { Tooltip } from 'components/tooltip'; import deepEqual from 'deep-equal'; @@ -110,33 +110,30 @@ export const MindWrapper = ({ editor, node, updateAttributes }) => {
)} +
+ + + + + 思维导图 + +
+
-