base commit
This commit is contained in:
@@ -5,9 +5,10 @@ import TiptapStarterKit from '@tiptap/starter-kit'
|
||||
|
||||
type RichTextMessageContentProps = {
|
||||
value: string
|
||||
tone?: 'default' | 'review' | 'chat'
|
||||
}
|
||||
|
||||
export function RichTextMessageContent({ value }: RichTextMessageContentProps) {
|
||||
export function RichTextMessageContent({ value, tone = 'default' }: RichTextMessageContentProps) {
|
||||
const editor = useEditor({
|
||||
extensions: [
|
||||
TiptapStarterKit.configure({ heading: false, codeBlock: false, blockquote: false, horizontalRule: false }),
|
||||
@@ -30,14 +31,31 @@ export function RichTextMessageContent({ value }: RichTextMessageContentProps) {
|
||||
outline: 'none',
|
||||
whiteSpace: 'pre-wrap',
|
||||
wordBreak: 'break-word',
|
||||
...(tone === 'review'
|
||||
? {
|
||||
fontSize: '0.875rem',
|
||||
lineHeight: 1.5,
|
||||
}
|
||||
: tone === 'chat'
|
||||
? {
|
||||
fontSize: '0.95rem',
|
||||
lineHeight: 1.45,
|
||||
}
|
||||
: {}),
|
||||
},
|
||||
'& .ProseMirror p': {
|
||||
m: 0,
|
||||
},
|
||||
'& .ProseMirror p + p': {
|
||||
mt: tone === 'review' ? 0.75 : tone === 'chat' ? 0.5 : 0.5,
|
||||
},
|
||||
'& .ProseMirror ul, & .ProseMirror ol': {
|
||||
m: 0,
|
||||
my: tone === 'review' ? 0.75 : tone === 'chat' ? 0.25 : 0,
|
||||
pl: 3,
|
||||
},
|
||||
'& .ProseMirror li + li': {
|
||||
mt: tone === 'review' ? 0.25 : tone === 'chat' ? 0.15 : 0,
|
||||
},
|
||||
}}
|
||||
>
|
||||
<EditorContent editor={editor} />
|
||||
|
||||
Reference in New Issue
Block a user