client: fix title style, fix doc extension

pull/160/head
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({
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: [] },
});

View File

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

View File

@ -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

View File

@ -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);
}
}
}

View File

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

View File

@ -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+',
});