@@ -399,20 +399,18 @@ export class TiptapCollabProvider extends HocuspocusProvider {
399399 return
400400 }
401401
402- if ( commentIndex > 0 ) {
403- const comment = thread . get ( 'comments' ) . get ( commentIndex )
404- const newComment = new Y . Map ( )
405-
406- newComment . set ( 'id' , comment . get ( 'id' ) )
407- newComment . set ( 'createdAt' , comment . get ( 'createdAt' ) )
408- newComment . set ( 'updatedAt' , ( new Date ( ) ) . toISOString ( ) )
409- newComment . set ( 'deletedAt' , ( new Date ( ) ) . toISOString ( ) )
410- newComment . set ( 'data' , comment . get ( 'data' ) )
411- newComment . set ( 'content' , null )
412-
413- thread . get ( 'deletedComments' ) . push ( [ newComment ] )
414- thread . get ( 'comments' ) . delete ( commentIndex )
415- }
402+ const comment = thread . get ( 'comments' ) . get ( commentIndex )
403+ const newComment = new Y . Map ( )
404+
405+ newComment . set ( 'id' , comment . get ( 'id' ) )
406+ newComment . set ( 'createdAt' , comment . get ( 'createdAt' ) )
407+ newComment . set ( 'updatedAt' , ( new Date ( ) ) . toISOString ( ) )
408+ newComment . set ( 'deletedAt' , ( new Date ( ) ) . toISOString ( ) )
409+ newComment . set ( 'data' , comment . get ( 'data' ) )
410+ newComment . set ( 'content' , comment . get ( 'content' ) )
411+
412+ thread . get ( 'deletedComments' ) . push ( [ newComment ] )
413+ thread . get ( 'comments' ) . delete ( commentIndex )
416414
417415 return thread . toJSON ( ) as TCollabThread
418416 }
0 commit comments