client: fix title style, fix doc extension

This commit is contained in:
fantasticit 2022-08-15 11:29:55 +08:00
parent dbf87fec68
commit 59e0c15c5f
6 changed files with 21 additions and 9 deletions

View File

@ -58,7 +58,7 @@ export const DocumentFullscreen: React.FC<IProps> = ({ data }) => {
const editor = useEditor({ const editor = useEditor({
editable: false, 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: [] }, content: { type: 'doc', content: [] },
}); });

View File

@ -33,6 +33,11 @@ export const DocumentVersion: React.FC<Partial<IProps>> = ({ documentId, onSelec
const editor = useEditor({ const editor = useEditor({
editable: false, editable: false,
editorProps: {
attributes: {
class: 'is-editable',
},
},
extensions: CollaborationKit, extensions: CollaborationKit,
content: { type: 'doc', content: [] }, content: { type: 'doc', content: [] },
}); });

View File

@ -149,7 +149,6 @@ export const Dragable = Extension.create({
if ( if (
!result || !result ||
result.node.type.name === 'doc' || result.node.type.name === 'doc' ||
result.node.type.name === 'documentWithTitle' ||
result.node.type.name === 'title' || result.node.type.name === 'title' ||
result.node.type.name === 'tableOfContents' || result.node.type.name === 'tableOfContents' ||
// empty paragraph // empty paragraph

View File

@ -9,19 +9,25 @@
&::before { &::before {
position: absolute; position: absolute;
bottom: 0;
height: 0; height: 0;
color: var(--semi-color-text-0); color: var(--semi-color-text-0);
pointer-events: none; pointer-events: none;
content: attr(data-placeholder); content: attr(data-placeholder);
}
}
&.is-withauthor {
.node-title::before {
bottom: 0;
transform: translateY(-4.2em); transform: translateY(-4.2em);
} }
}
&.is-editable { &.is-editable {
&::before { .node-title::before {
color: #aaa; bottom: 0;
transform: translateY(-1.7em); color: #aaa;
} transform: translateY(-1.7em);
} }
} }
} }

View File

@ -54,6 +54,9 @@ export const EditorInstance = forwardRef((props: IProps, ref) => {
editorProps: { editorProps: {
// @ts-ignore // @ts-ignore
taskItemClickable: true, taskItemClickable: true,
attributes: {
class: 'is-withauthor',
},
}, },
extensions: [ extensions: [
...CollaborationKit, ...CollaborationKit,

View File

@ -69,7 +69,6 @@ import { markdownToProsemirror } from 'tiptap/markdown/markdown-to-prosemirror';
import { prosemirrorToMarkdown } from 'tiptap/markdown/prosemirror-to-markdown'; import { prosemirrorToMarkdown } from 'tiptap/markdown/prosemirror-to-markdown';
const DocumentWithTitle = Document.extend({ const DocumentWithTitle = Document.extend({
name: 'documentWithTitle',
content: 'title block+', content: 'title block+',
}); });