@@ -118,32 +118,34 @@ export const getBlockNoteExtensions = <BSchema extends BlockSchema>(opts: {
118118 fragment : opts . collaboration . fragment ,
119119 } )
120120 ) ;
121- const defaultRender = ( user : { color : string ; name : string } ) => {
122- const cursor = document . createElement ( "span" ) ;
121+ if ( opts . collaboration . provider ?. awareness ) {
122+ const defaultRender = ( user : { color : string ; name : string } ) => {
123+ const cursor = document . createElement ( "span" ) ;
123124
124- cursor . classList . add ( styles [ "collaboration-cursor__caret" ] ) ;
125- cursor . setAttribute ( "style" , `border-color: ${ user . color } ` ) ;
125+ cursor . classList . add ( styles [ "collaboration-cursor__caret" ] ) ;
126+ cursor . setAttribute ( "style" , `border-color: ${ user . color } ` ) ;
126127
127- const label = document . createElement ( "span" ) ;
128+ const label = document . createElement ( "span" ) ;
128129
129- label . classList . add ( styles [ "collaboration-cursor__label" ] ) ;
130- label . setAttribute ( "style" , `background-color: ${ user . color } ` ) ;
131- label . insertBefore ( document . createTextNode ( user . name ) , null ) ;
130+ label . classList . add ( styles [ "collaboration-cursor__label" ] ) ;
131+ label . setAttribute ( "style" , `background-color: ${ user . color } ` ) ;
132+ label . insertBefore ( document . createTextNode ( user . name ) , null ) ;
132133
133- const nonbreakingSpace1 = document . createTextNode ( "\u2060" ) ;
134- const nonbreakingSpace2 = document . createTextNode ( "\u2060" ) ;
135- cursor . insertBefore ( nonbreakingSpace1 , null ) ;
136- cursor . insertBefore ( label , null ) ;
137- cursor . insertBefore ( nonbreakingSpace2 , null ) ;
138- return cursor ;
139- } ;
140- ret . push (
141- CollaborationCursor . configure ( {
142- user : opts . collaboration . user ,
143- render : opts . collaboration . renderCursor || defaultRender ,
144- provider : opts . collaboration . provider ,
145- } )
146- ) ;
134+ const nonbreakingSpace1 = document . createTextNode ( "\u2060" ) ;
135+ const nonbreakingSpace2 = document . createTextNode ( "\u2060" ) ;
136+ cursor . insertBefore ( nonbreakingSpace1 , null ) ;
137+ cursor . insertBefore ( label , null ) ;
138+ cursor . insertBefore ( nonbreakingSpace2 , null ) ;
139+ return cursor ;
140+ } ;
141+ ret . push (
142+ CollaborationCursor . configure ( {
143+ user : opts . collaboration . user ,
144+ render : opts . collaboration . renderCursor || defaultRender ,
145+ provider : opts . collaboration . provider ,
146+ } )
147+ ) ;
148+ }
147149 } else {
148150 // disable history extension when collaboration is enabled as Yjs takes care of undo / redo
149151 ret . push ( History ) ;
0 commit comments