Bug: Change selection of Annotations.TextHighlightAnnotation changes comment

23 views
Skip to first unread message

Volker Andres

unread,
Apr 12, 2017, 4:19:42 PM4/12/17
to PDFTron WebViewer
When changing the selection of Annotations.TextHighlightAnnotation in the UI, the comment (content) of the annotation gets also updated with the new text auf the selection. It is not possible to see this in the samples, because the "refreshAnnotationList" is not refreshing the list correctly. Fixed the refreshing with:

if (action === "modify") {
var annotation = annotations[0];
me.refreshAnnotationItem(annotation, me.$annotList.find('[data-id=' + annotation.Id + ']'));
}

I can not find the code where the content gets updated, so I think it will be in the minified code.
Bildschirmfoto 2017-04-12 um 17.22.06.png

Justin Jung

unread,
Apr 13, 2017, 7:12:00 PM4/13/17
to PDFTron WebViewer on behalf of Volker Andres
Hello,

Thanks for the report. This is a bug in MobileReaderControl, and your solution would be proper way of handling it.
The change will be a part of future releases.

Justin Jung
Software Developer
PDFTron Systems Inc.

Volker Andres

unread,
Apr 17, 2017, 1:14:34 PM4/17/17
to PDFTron WebViewer
Hi Justin

Thank you. This is the fix for the 'refreshAnnotationList' problem. The other problem I am not able to fix by myself is, that the change of the highlighted text changes the content of the
TextHighlightAnnotation. The initial set of the content is in MobileReaderControl. But the update is somewhere else...

Justin Jung

unread,
Apr 18, 2017, 9:04:29 PM4/18/17
to PDFTron WebViewer on behalf of Volker Andres
Hello,

Can you clarify what you mean by "the change of the highlighted text changes the content of the TextHighlightAnnotation"? What is exactly the problem? Could you provide us steps to reproduce the problem?

Volker Andres

unread,
Apr 19, 2017, 11:31:09 AM4/19/17
to PDFTron WebViewer
Hi Justin

I remove this line, which sets the initial content of the TextHighlightAnnotation in MobileReaderControl.js to implement my own logic:

textAnnot.setContents(readerControl.docViewer.getSelectedText());

Now when updating the Annotation, my custom content gets overriden. As I mentioned before, it is not possible to see this in the samples, because the refeshing is broken. These are the steps to reproduce:

1. Create an
TextHighlightAnnotation -> the marked text is now the content
2. add a note for this annotation -> the note is now the content
3. select the annotation in front of the canvas and change the selection (e.g. drag the right text marker one letter further) -> the marked text is again the conent of the annotatiion, the note is overwritten. (you need to console.log this or apply my fix, to see it in the samples)

Tell me, if you need more information.

Justin Jung

unread,
Apr 19, 2017, 3:34:33 PM4/19/17
to PDFTron WebViewer on behalf of Volker Andres
Hello,

If you don't want the note content to be overwritten with selection, you can set window.Tools.TextAnnotationCreateTool.AUTO_SET_TEXT to false.

Volker Andres

unread,
Apr 20, 2017, 11:59:15 AM4/20/17
to PDFTron WebViewer
Yes, this works. Thanks
Reply all
Reply to author
Forward
0 new messages