fix: fix comment extensions

pull/29/head
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 {
z-index: 1;
opacity: 0.2;
opacity: .2;
box-sizing: border-box;
background-clip: padding;
}

View File

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

View File

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

View File

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