Skip to content

Commit 3fe0b91

Browse files
committed
fix(provider): allow deletion of first item
1 parent e706537 commit 3fe0b91

1 file changed

Lines changed: 12 additions & 14 deletions

File tree

packages/provider/src/TiptapCollabProvider.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)