@@ -12,7 +12,7 @@ import { BlockNoteView } from '@blocknote/mantine';
1212import '@blocknote/mantine/style.css' ;
1313import { useCreateBlockNote } from '@blocknote/react' ;
1414import { HocuspocusProvider } from '@hocuspocus/provider' ;
15- import { useEffect , useRef } from 'react' ;
15+ import { useEffect , useMemo , useRef } from 'react' ;
1616import { useTranslation } from 'react-i18next' ;
1717import { css } from 'styled-components' ;
1818import * as Y from 'yjs' ;
@@ -101,6 +101,13 @@ export const BlockNoteEditor = ({ doc, provider }: BlockNoteEditorProps) => {
101101
102102 const threadStore = useComments ( doc . id , canSeeComment , user ) ;
103103
104+ const currentUserAvatarUrl = useMemo ( ( ) => {
105+ if ( ! canSeeComment ) {
106+ return undefined ;
107+ }
108+ return avatarUrlFromName ( collabName , themeTokens ?. font ?. families ?. base ) ;
109+ } , [ canSeeComment , collabName , themeTokens ?. font ?. families ?. base ] ) ;
110+
104111 const editor : DocsBlockNoteEditor = useCreateBlockNote (
105112 {
106113 collaboration : {
@@ -201,7 +208,7 @@ export const BlockNoteEditor = ({ doc, provider }: BlockNoteEditorProps) => {
201208 ref = { refEditorContainer }
202209 $css = { css `
203210 ${ cssEditor } ;
204- ${ cssComments ( canSeeComment ) }
211+ ${ cssComments ( canSeeComment , currentUserAvatarUrl ) }
205212 ` }
206213 >
207214 { errorAttachment && (
0 commit comments