Skip to content

Commit 729f2bb

Browse files
authored
Merge pull request #20058 from calixteman/use_creationdate_popup
Use the creation date in the popup when there is no modification date
2 parents b3794c7 + bb52a44 commit 729f2bb

File tree

6 files changed

+20
-6
lines changed

6 files changed

+20
-6
lines changed

src/core/annotation.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3842,6 +3842,7 @@ class PopupAnnotation extends Annotation {
38423842
return;
38433843
}
38443844
this.data.parentRect = lookupNormalRect(parentItem.getArray("Rect"), null);
3845+
this.data.creationDate = parentItem.get("CreationDate") || "";
38453846

38463847
const rt = parentItem.get("RT");
38473848
if (isName(rt, AnnotationReplyType.GROUP)) {

src/display/annotation_layer.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2071,7 +2071,7 @@ class PopupAnnotationElement extends AnnotationElement {
20712071
container: this.container,
20722072
color: this.data.color,
20732073
titleObj: this.data.titleObj,
2074-
modificationDate: this.data.modificationDate,
2074+
modificationDate: this.data.modificationDate || this.data.creationDate,
20752075
contentsObj: this.data.contentsObj,
20762076
richText: this.data.richText,
20772077
rect: this.data.rect,
@@ -2212,14 +2212,17 @@ class PopupElement {
22122212

22132213
const header = document.createElement("span");
22142214
header.className = "header";
2215-
const title = document.createElement("h1");
2216-
header.append(title);
2217-
({ dir: title.dir, str: title.textContent } = this.#titleObj);
2215+
if (this.#titleObj?.str) {
2216+
const title = document.createElement("span");
2217+
title.className = "title";
2218+
header.append(title);
2219+
({ dir: title.dir, str: title.textContent } = this.#titleObj);
2220+
}
22182221
popup.append(header);
22192222

22202223
if (this.#dateObj) {
22212224
const modificationDate = document.createElement("time");
2222-
modificationDate.classList.add("popupDate");
2225+
modificationDate.className = "popupDate";
22232226
modificationDate.setAttribute(
22242227
"data-l10n-id",
22252228
"pdfjs-annotation-date-time-string"

test/pdfs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,3 +730,4 @@
730730
!empty#hash.pdf
731731
!bug1885505.pdf
732732
!bug1974436.pdf
733+
!firefox_logo.pdf

test/pdfs/firefox_logo.pdf

229 KB
Binary file not shown.

test/test_manifest.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12156,5 +12156,13 @@
1215612156
"rounds": 1,
1215712157
"type": "eq",
1215812158
"annotations": true
12159+
},
12160+
{
12161+
"id": "firefox_logo",
12162+
"file": "pdfs/firefox_logo.pdf",
12163+
"md5": "e212e0cec3e39907950c597782a42c3a",
12164+
"rounds": 1,
12165+
"type": "eq",
12166+
"annotations": true
1215912167
}
1216012168
]

web/annotation_layer_builder.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,9 @@
342342
display: inline-block;
343343
}
344344

345-
.popup > .header h1 {
345+
.popup > .header > .title {
346346
display: inline;
347+
font-weight: bold;
347348
}
348349

349350
.popup > .header .popupDate {

0 commit comments

Comments
 (0)