fix: fix comment extensions

This commit is contained in:
fantasticit 2022-04-25 09:56:20 +08:00
parent 7d1afdd394
commit 9042da011f
4 changed files with 19 additions and 16 deletions

View File

@ -27,7 +27,7 @@
.Resizer { .Resizer {
z-index: 1; z-index: 1;
opacity: 0.2; opacity: .2;
box-sizing: border-box; box-sizing: border-box;
background-clip: padding; background-clip: padding;
} }

View File

@ -1,14 +1,3 @@
import BuiltInPlaceholder from '@tiptap/extension-placeholder'; import BuiltInPlaceholder from '@tiptap/extension-placeholder';
export const Placeholder = BuiltInPlaceholder.configure({ export const Placeholder = BuiltInPlaceholder;
placeholder: ({ node, editor }) => {
if (!editor.isEditable) return;
if (node.type.name === 'title') {
return '请输入标题';
}
return '输入 / 唤起更多';
},
showOnlyCurrent: false,
showOnlyWhenEditable: true,
});

View File

@ -112,7 +112,6 @@ export const CommentMenuBar: React.FC<{ editor: any }> = ({ editor }) => {
<Divider /> <Divider />
<Heading editor={editor} /> <Heading editor={editor} />
<FontSize editor={editor} />
<Bold editor={editor} /> <Bold editor={editor} />
<Italic editor={editor} /> <Italic editor={editor} />
<Underline editor={editor} /> <Underline editor={editor} />

View File

@ -89,7 +89,18 @@ export const BaseKit = [
Mind, Mind,
OrderedList, OrderedList,
Paragraph, Paragraph,
Placeholder, Placeholder.configure({
placeholder: ({ node, editor }) => {
if (!editor.isEditable) return;
if (node.type.name === 'title') {
return '请输入标题';
}
return '输入 / 唤起更多';
},
showOnlyCurrent: false,
showOnlyWhenEditable: true,
}),
QuickInsert, QuickInsert,
SearchNReplace, SearchNReplace,
SelectionExtension, SelectionExtension,
@ -122,6 +133,7 @@ export const CommentKit = [
Color, Color,
ColorHighlighter, ColorHighlighter,
Dropcursor, Dropcursor,
Emoji,
Focus, Focus,
FontSize, FontSize,
Gapcursor, Gapcursor,
@ -137,7 +149,10 @@ export const CommentKit = [
Mention, Mention,
OrderedList, OrderedList,
Paragraph, Paragraph,
Placeholder, Placeholder.configure({
placeholder: '请输入内容',
showOnlyWhenEditable: true,
}),
Strike, Strike,
Subscript, Subscript,
Superscript, Superscript,