diff --git a/packages/client/src/styles/globals.scss b/packages/client/src/styles/globals.scss index 08554c4..5d10e4d 100644 --- a/packages/client/src/styles/globals.scss +++ b/packages/client/src/styles/globals.scss @@ -27,7 +27,7 @@ .Resizer { z-index: 1; - opacity: 0.2; + opacity: .2; box-sizing: border-box; background-clip: padding; } diff --git a/packages/client/src/tiptap/extensions/placeholder.ts b/packages/client/src/tiptap/extensions/placeholder.ts index f2b86fe..a60a49f 100644 --- a/packages/client/src/tiptap/extensions/placeholder.ts +++ b/packages/client/src/tiptap/extensions/placeholder.ts @@ -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; diff --git a/packages/client/src/tiptap/menubar.tsx b/packages/client/src/tiptap/menubar.tsx index 505b848..32ae1f9 100644 --- a/packages/client/src/tiptap/menubar.tsx +++ b/packages/client/src/tiptap/menubar.tsx @@ -112,7 +112,6 @@ export const CommentMenuBar: React.FC<{ editor: any }> = ({ editor }) => { - diff --git a/packages/client/src/tiptap/start-kit.tsx b/packages/client/src/tiptap/start-kit.tsx index 5714163..3e36653 100644 --- a/packages/client/src/tiptap/start-kit.tsx +++ b/packages/client/src/tiptap/start-kit.tsx @@ -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,