diff --git a/packages/client/src/components/document/fullscreen/index.tsx b/packages/client/src/components/document/fullscreen/index.tsx index ecd31037..cd67f0d0 100644 --- a/packages/client/src/components/document/fullscreen/index.tsx +++ b/packages/client/src/components/document/fullscreen/index.tsx @@ -58,7 +58,7 @@ export const DocumentFullscreen: React.FC = ({ data }) => { const editor = useEditor({ editable: false, - extensions: CollaborationKit.filter((ext) => ['title', 'documentWithTitle'].indexOf(ext.name) < 0).concat(Document), + extensions: CollaborationKit.filter((ext) => ['title', 'doc'].indexOf(ext.name) < 0).concat(Document), content: { type: 'doc', content: [] }, }); diff --git a/packages/client/src/components/document/version/index.tsx b/packages/client/src/components/document/version/index.tsx index fe0819aa..738f0154 100644 --- a/packages/client/src/components/document/version/index.tsx +++ b/packages/client/src/components/document/version/index.tsx @@ -33,6 +33,11 @@ export const DocumentVersion: React.FC> = ({ documentId, onSelec const editor = useEditor({ editable: false, + editorProps: { + attributes: { + class: 'is-editable', + }, + }, extensions: CollaborationKit, content: { type: 'doc', content: [] }, }); diff --git a/packages/client/src/tiptap/core/extensions/dragable.ts b/packages/client/src/tiptap/core/extensions/dragable.ts index e418483c..12cb815b 100644 --- a/packages/client/src/tiptap/core/extensions/dragable.ts +++ b/packages/client/src/tiptap/core/extensions/dragable.ts @@ -149,7 +149,6 @@ export const Dragable = Extension.create({ if ( !result || result.node.type.name === 'doc' || - result.node.type.name === 'documentWithTitle' || result.node.type.name === 'title' || result.node.type.name === 'tableOfContents' || // empty paragraph diff --git a/packages/client/src/tiptap/core/styles/title.scss b/packages/client/src/tiptap/core/styles/title.scss index b00b51ef..71f269d9 100644 --- a/packages/client/src/tiptap/core/styles/title.scss +++ b/packages/client/src/tiptap/core/styles/title.scss @@ -9,19 +9,25 @@ &::before { position: absolute; - bottom: 0; height: 0; color: var(--semi-color-text-0); pointer-events: none; content: attr(data-placeholder); + } + } + + &.is-withauthor { + .node-title::before { + bottom: 0; transform: translateY(-4.2em); } + } - &.is-editable { - &::before { - color: #aaa; - transform: translateY(-1.7em); - } + &.is-editable { + .node-title::before { + bottom: 0; + color: #aaa; + transform: translateY(-1.7em); } } } diff --git a/packages/client/src/tiptap/editor/collaboration/collaboration/editor.tsx b/packages/client/src/tiptap/editor/collaboration/collaboration/editor.tsx index bfb596ca..5b956ca1 100644 --- a/packages/client/src/tiptap/editor/collaboration/collaboration/editor.tsx +++ b/packages/client/src/tiptap/editor/collaboration/collaboration/editor.tsx @@ -54,6 +54,9 @@ export const EditorInstance = forwardRef((props: IProps, ref) => { editorProps: { // @ts-ignore taskItemClickable: true, + attributes: { + class: 'is-withauthor', + }, }, extensions: [ ...CollaborationKit, diff --git a/packages/client/src/tiptap/editor/collaboration/kit.ts b/packages/client/src/tiptap/editor/collaboration/kit.ts index 3cce7185..54b9ae3b 100644 --- a/packages/client/src/tiptap/editor/collaboration/kit.ts +++ b/packages/client/src/tiptap/editor/collaboration/kit.ts @@ -69,7 +69,6 @@ import { markdownToProsemirror } from 'tiptap/markdown/markdown-to-prosemirror'; import { prosemirrorToMarkdown } from 'tiptap/markdown/prosemirror-to-markdown'; const DocumentWithTitle = Document.extend({ - name: 'documentWithTitle', content: 'title block+', });