Closed drichar closed 4 years ago
Thanks for reporting this. I was able to reproduce it with your information. Looks like the comment's commentList
wasn't being set when initializing a comment through the API. This PR should fix and updates the integration tests as well: https://github.com/contently/videojs-annotation-comments/pull/58
@drichar this should be fixed with the latest release 2.0.1. Closing this issue for now but please let me know here if you still have trouble.
Thank you @jackpope it now works as expected!
Expected Behavior
Any comment can be deleted programmatically via API with the
destroyComment
eventActual Behavior
Comments created by the UI or defined in
annotationsObjects
on initialization can be deleted withdestroyComment
, but comments created programmatically with thenewComment
event result in this error:https://github.com/contently/videojs-annotation-comments/blob/ee905aa65a30d56f62edf2f5857f366c2bdaada9/src/js/lib/event_dispatcher.js#L39 It seems that comments created programmatically are set inside
plugin.annotationState
with thecommentList
property undefined:Steps to Reproduce the Problem
annotationsObjects
withid: 1
plugin.fire('newComment', { annotationId: 1, body: "My comment string" })
plugin.fire('destroyComment', { id: newCommentId })
I confirmed this is happening by calling
destroyComment
in this test: https://github.com/contently/videojs-annotation-comments/blob/a5c7d899d6498352e155da9f6450fe553c598dca/test/mocha/features/api_test.js#L125Specifications