11import { CommentsExtension } from '@blocknote/core/comments' ;
22import { BlockNoteView } from '@blocknote/mantine' ;
33import { ThreadsSidebar , useCreateBlockNote } from '@blocknote/react' ;
4+ import { HocuspocusProvider } from '@hocuspocus/provider' ;
45import { useTranslation } from 'react-i18next' ;
56import { css } from 'styled-components' ;
7+ import { Awareness } from 'y-protocols/awareness.js' ;
68
79import { Box , ButtonCloseModal , Text } from '@/components/' ;
810import { Doc } from '@/docs/doc-management' ;
@@ -13,9 +15,14 @@ import { useComments } from './useComments';
1315interface CommentSideBarProps {
1416 doc : Doc ;
1517 onClose : ( ) => void ;
18+ provider : HocuspocusProvider ;
1619}
1720
18- export const CommentSideBar = ( { doc, onClose } : CommentSideBarProps ) => {
21+ export const CommentSideBar = ( {
22+ doc,
23+ onClose,
24+ provider,
25+ } : CommentSideBarProps ) => {
1926 const { user } = useAuth ( ) ;
2027 const canSeeComment = doc . abilities . comment ;
2128 const { t } = useTranslation ( ) ;
@@ -28,9 +35,17 @@ export const CommentSideBar = ({ doc, onClose }: CommentSideBarProps) => {
2835
2936 const editor = useCreateBlockNote (
3037 {
38+ collaboration : {
39+ fragment : provider . document . getXmlFragment ( 'document-store' ) ,
40+ user : {
41+ name : '' ,
42+ color : '' ,
43+ } ,
44+ provider : provider as { awareness ?: Awareness | undefined } ,
45+ } ,
3146 extensions : [ CommentsExtension ( { threadStore, resolveUsers } ) ] ,
3247 } ,
33- [ threadStore , resolveUsers ] ,
48+ [ threadStore , resolveUsers , provider ] ,
3449 ) ;
3550
3651 return (
@@ -52,14 +67,14 @@ export const CommentSideBar = ({ doc, onClose }: CommentSideBarProps) => {
5267 </ Box >
5368
5469 < BlockNoteView
55- className = "--docs--main-editor"
70+ // className="--docs--main-editor"
5671 aria-label = { t ( 'Document editor' ) }
5772 editor = { editor }
5873 formattingToolbar = { false }
5974 slashMenu = { false }
6075 theme = "light"
6176 comments = { false }
62- renderEditor = { false }
77+ // renderEditor={false}
6378 >
6479 < ThreadsSidebar filter = "all" sort = "recent-activity" />
6580 </ BlockNoteView >
0 commit comments