|
1 | 1 | import { memo, useCallback, useEffect, useMemo, useRef } from 'react' |
2 | 2 | import ReactMarkdown from 'react-markdown' |
3 | | -import remarkGfm from 'remark-gfm' |
4 | 3 | import { type NodeProps, useUpdateNodeInternals } from 'reactflow' |
| 4 | +import remarkGfm from 'remark-gfm' |
5 | 5 | import { cn } from '@/lib/utils' |
6 | 6 | import { useUserPermissionsContext } from '@/app/workspace/[workspaceId]/providers/workspace-permissions-provider' |
7 | 7 | import { usePanelEditorStore } from '@/stores/panel-new/editor/store' |
@@ -38,29 +38,52 @@ const NoteMarkdown = memo(function NoteMarkdown({ content }: { content: string } |
38 | 38 | <ReactMarkdown |
39 | 39 | remarkPlugins={[remarkGfm]} |
40 | 40 | components={{ |
41 | | - p: ({ children }) => <p className='mb-0 text-sm text-[#E5E5E5]'>{children}</p>, |
42 | | - h1: ({ children }) => <h1 className='mt-0 mb-[-2px] text-lg font-semibold text-[#E5E5E5]'>{children}</h1>, |
43 | | - h2: ({ children }) => <h2 className='mt-0 mb-[-2px] text-base font-semibold text-[#E5E5E5]'>{children}</h2>, |
44 | | - h3: ({ children }) => <h3 className='mt-0 mb-[-2px] text-sm font-semibold text-[#E5E5E5]'>{children}</h3>, |
45 | | - h4: ({ children }) => <h4 className='mt-0 mb-[-2px] text-xs font-semibold text-[#E5E5E5]'>{children}</h4>, |
46 | | - ul: ({ children }) => <ul className='-mt-[2px] mb-0 list-disc pl-4 text-sm text-[#E5E5E5]'>{children}</ul>, |
47 | | - ol: ({ children }) => <ol className='-mt-[2px] mb-0 list-decimal pl-4 text-sm text-[#E5E5E5]'>{children}</ol>, |
| 41 | + p: ({ children }) => <p className='mb-0 text-[#E5E5E5] text-sm'>{children}</p>, |
| 42 | + h1: ({ children }) => ( |
| 43 | + <h1 className='mt-0 mb-[-2px] font-semibold text-[#E5E5E5] text-lg'>{children}</h1> |
| 44 | + ), |
| 45 | + h2: ({ children }) => ( |
| 46 | + <h2 className='mt-0 mb-[-2px] font-semibold text-[#E5E5E5] text-base'>{children}</h2> |
| 47 | + ), |
| 48 | + h3: ({ children }) => ( |
| 49 | + <h3 className='mt-0 mb-[-2px] font-semibold text-[#E5E5E5] text-sm'>{children}</h3> |
| 50 | + ), |
| 51 | + h4: ({ children }) => ( |
| 52 | + <h4 className='mt-0 mb-[-2px] font-semibold text-[#E5E5E5] text-xs'>{children}</h4> |
| 53 | + ), |
| 54 | + ul: ({ children }) => ( |
| 55 | + <ul className='-mt-[2px] mb-0 list-disc pl-4 text-[#E5E5E5] text-sm'>{children}</ul> |
| 56 | + ), |
| 57 | + ol: ({ children }) => ( |
| 58 | + <ol className='-mt-[2px] mb-0 list-decimal pl-4 text-[#E5E5E5] text-sm'>{children}</ol> |
| 59 | + ), |
48 | 60 | li: ({ children }) => <li className='mb-0'>{children}</li>, |
49 | 61 | code: ({ inline, children }: any) => |
50 | 62 | inline ? ( |
51 | | - <code className='rounded bg-[#393939] px-1 py-0.5 text-xs text-[#F59E0B]'>{children}</code> |
| 63 | + <code className='rounded bg-[#393939] px-1 py-0.5 text-[#F59E0B] text-xs'> |
| 64 | + {children} |
| 65 | + </code> |
52 | 66 | ) : ( |
53 | | - <code className='block rounded bg-[#1A1A1A] p-2 text-xs text-[#E5E5E5]'>{children}</code> |
| 67 | + <code className='block rounded bg-[#1A1A1A] p-2 text-[#E5E5E5] text-xs'> |
| 68 | + {children} |
| 69 | + </code> |
54 | 70 | ), |
55 | 71 | a: ({ href, children }) => ( |
56 | | - <a href={href} target='_blank' rel='noopener noreferrer' className='text-[#33B4FF] underline-offset-2 hover:underline'> |
| 72 | + <a |
| 73 | + href={href} |
| 74 | + target='_blank' |
| 75 | + rel='noopener noreferrer' |
| 76 | + className='text-[#33B4FF] underline-offset-2 hover:underline' |
| 77 | + > |
57 | 78 | {children} |
58 | 79 | </a> |
59 | 80 | ), |
60 | 81 | strong: ({ children }) => <strong className='font-semibold text-white'>{children}</strong>, |
61 | 82 | em: ({ children }) => <em className='text-[#B8B8B8]'>{children}</em>, |
62 | 83 | blockquote: ({ children }) => ( |
63 | | - <blockquote className='m-0 border-l-2 border-[#F59E0B] pl-3 italic text-[#B8B8B8]'>{children}</blockquote> |
| 84 | + <blockquote className='m-0 border-[#F59E0B] border-l-2 pl-3 text-[#B8B8B8] italic'> |
| 85 | + {children} |
| 86 | + </blockquote> |
64 | 87 | ), |
65 | 88 | }} |
66 | 89 | > |
@@ -197,7 +220,9 @@ export const NoteBlock = memo(function NoteBlock({ id, data }: NodeProps<NoteBlo |
197 | 220 | ) : showMarkdown ? ( |
198 | 221 | <NoteMarkdown content={content} /> |
199 | 222 | ) : ( |
200 | | - <p className='whitespace-pre-wrap text-[#E5E5E5] text-sm leading-relaxed'>{content}</p> |
| 223 | + <p className='whitespace-pre-wrap text-[#E5E5E5] text-sm leading-relaxed'> |
| 224 | + {content} |
| 225 | + </p> |
201 | 226 | )} |
202 | 227 | </div> |
203 | 228 | </div> |
|
0 commit comments