diff --git a/packages/client/src/components/tiptap/components/attachment/index.tsx b/packages/client/src/components/tiptap/components/attachment/index.tsx index 093e61fb..726a2d77 100644 --- a/packages/client/src/components/tiptap/components/attachment/index.tsx +++ b/packages/client/src/components/tiptap/components/attachment/index.tsx @@ -149,5 +149,9 @@ export const AttachmentWrapper = ({ editor, node, updateAttributes }) => { } })(); - return {content}; + return ( + + {content} + + ); }; diff --git a/packages/client/src/components/tiptap/components/documentReference/index.module.scss b/packages/client/src/components/tiptap/components/documentReference/index.module.scss index 80d2876b..55193b17 100644 --- a/packages/client/src/components/tiptap/components/documentReference/index.module.scss +++ b/packages/client/src/components/tiptap/components/documentReference/index.module.scss @@ -33,4 +33,16 @@ margin-left: 8px; } } + + .empty { + display: flex; + align-items: center; + padding: 8px; + border: 1px solid var(--semi-color-border); + margin-top: 12px; + border-radius: var(--border-radius); + text-decoration: none; + color: var(--semi-color-text-1); + cursor: not-allowed; + } } diff --git a/packages/client/src/components/tiptap/components/documentReference/index.tsx b/packages/client/src/components/tiptap/components/documentReference/index.tsx index 434633f2..b2428964 100644 --- a/packages/client/src/components/tiptap/components/documentReference/index.tsx +++ b/packages/client/src/components/tiptap/components/documentReference/index.tsx @@ -47,18 +47,24 @@ export const DocumentReferenceWrapper = ({ editor, node, updateAttributes }) => )} /> )} - - - - {title || '请选择文档'} - - + {wikiId && documentId ? ( + + + + {title || '请选择文档'} + + + ) : ( +
+ {'用户未选择文档'} +
+ )} diff --git a/packages/client/src/components/tiptap/components/image/index.tsx b/packages/client/src/components/tiptap/components/image/index.tsx index 14388389..39a6f66f 100644 --- a/packages/client/src/components/tiptap/components/image/index.tsx +++ b/packages/client/src/components/tiptap/components/image/index.tsx @@ -1,4 +1,4 @@ -import { NodeViewWrapper } from '@tiptap/react'; +import { NodeViewWrapper, NodeViewContent } from '@tiptap/react'; import { Resizeable } from 'components/resizeable'; import { useEffect, useRef } from 'react'; import { Typography, Spin } from '@douyinfe/semi-ui'; @@ -87,6 +87,7 @@ export const ImageWrapper = ({ editor, node, updateAttributes }) => { return ( {content} + ); }; diff --git a/packages/client/src/components/tiptap/extensions/attachment.ts b/packages/client/src/components/tiptap/extensions/attachment.ts index b9eba454..2cd406e7 100644 --- a/packages/client/src/components/tiptap/extensions/attachment.ts +++ b/packages/client/src/components/tiptap/extensions/attachment.ts @@ -12,6 +12,8 @@ declare module '@tiptap/core' { export const Attachment = Node.create({ name: 'attachment', + content: '', + marks: '', group: 'block', draggable: true, atom: true, diff --git a/packages/client/src/components/tiptap/extensions/image.ts b/packages/client/src/components/tiptap/extensions/image.ts index 80d9a614..00325d7b 100644 --- a/packages/client/src/components/tiptap/extensions/image.ts +++ b/packages/client/src/components/tiptap/extensions/image.ts @@ -16,7 +16,12 @@ export const Image = BuiltInImage.extend({ addOptions() { return { ...this.parent?.(), - inline: true, + inline: false, + content: '', + marks: '', + group: 'block', + draggable: true, + atom: true, }; }, addAttributes() {