Skip to content

Comment is not serialized following a single save-load cycle (getSerializedAnnotations, addEditorAnnotation) #3116

@kkoniuszy

Description

@kkoniuszy

In pdf.js, annotationEditor.addComment() has a hasEditedComment check. Comments that were deserialized from a copy don't pass this because initialText === text.

Because of that, comments are lost in the following scenario:

  1. User makes a highlight and adds a comment on it
  2. Annotations are serialized using pdfViewerService.getSerializedAnnotations() and saved to external storage.
  3. User reloads the document
  4. Annotations are fetched from the external storage and loaded using pdfViewerService.addEditorAnnotation()
  5. User annotates something else and doesn't touch the comment
  6. Annotations are saved
  7. User reloads document
  8. Annotations are fetched and loaded

I already have a fix and I'll make a PR in the pdf.js fork. I'm just creating this issue to have something to reference in the commit messages and code comments.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions