Skip to content

Commit

Permalink
Add a HTML containter for locked FreeText annotations in order to be …
Browse files Browse the repository at this point in the history
…able to display a popup (follow-up iof mozilla#17070)
  • Loading branch information
calixteman committed Oct 5, 2023
1 parent c4c24c6 commit e737638
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -3724,6 +3724,8 @@ class FreeTextAnnotation extends MarkupAnnotation {
// But if it has the noHTML flag, it means that we don't want to be able
// to modify it so we can just draw it on the main canvas.
this.data.hasOwnCanvas = !this.data.noHTML;
// We want to be able to add mouse listeners to the annotation.
this.data.noHTML = false;

const { evaluatorOptions, xref } = params;
this.data.annotationType = AnnotationType.FREETEXT;
Expand Down
11 changes: 11 additions & 0 deletions src/display/annotation_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,14 @@ class AnnotationElement {
}
}

get _isEditable() {
return false;
}

_editOnDoubleClick() {
if (!this._isEditable) {
return;
}
const {
annotationEditorType: mode,
data: { id: editId },
Expand Down Expand Up @@ -2347,6 +2354,10 @@ class FreeTextAnnotationElement extends AnnotationElement {

return this.container;
}

get _isEditable() {
return this.data.hasOwnCanvas;
}
}

class LineAnnotationElement extends AnnotationElement {
Expand Down

0 comments on commit e737638

Please sign in to comment.