diff --git a/packages/client/src/components/document/fullscreen/index.tsx b/packages/client/src/components/document/fullscreen/index.tsx index ecd3103..cd67f0d 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 fe0819a..738f015 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 e418483..12cb815 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 b00b51e..71f269d 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 bfb596c..5b956ca 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 3cce718..54b9ae3 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+', });