From e737638a404b3aa9d66f73d6a688eccaf6b6ee91 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Thu, 5 Oct 2023 14:01:34 +0200 Subject: [PATCH] Add a HTML containter for locked FreeText annotations in order to be able to display a popup (follow-up iof #17070) --- src/core/annotation.js | 2 ++ src/display/annotation_layer.js | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/core/annotation.js b/src/core/annotation.js index e59af8713..e6e01dc06 100644 --- a/src/core/annotation.js +++ b/src/core/annotation.js @@ -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; diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index 32287337f..da2745da8 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -671,7 +671,14 @@ class AnnotationElement { } } + get _isEditable() { + return false; + } + _editOnDoubleClick() { + if (!this._isEditable) { + return; + } const { annotationEditorType: mode, data: { id: editId }, @@ -2347,6 +2354,10 @@ class FreeTextAnnotationElement extends AnnotationElement { return this.container; } + + get _isEditable() { + return this.data.hasOwnCanvas; + } } class LineAnnotationElement extends AnnotationElement {