Merge pull request #20058 from calixteman/use_creationdate_popup

Use the creation date in the popup when there is no modification date
This commit is contained in:
calixteman 2025-07-07 10:55:28 +02:00 committed by GitHub
commit 729f2bb148
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 20 additions and 6 deletions

View File

@ -3842,6 +3842,7 @@ class PopupAnnotation extends Annotation {
return; return;
} }
this.data.parentRect = lookupNormalRect(parentItem.getArray("Rect"), null); this.data.parentRect = lookupNormalRect(parentItem.getArray("Rect"), null);
this.data.creationDate = parentItem.get("CreationDate") || "";
const rt = parentItem.get("RT"); const rt = parentItem.get("RT");
if (isName(rt, AnnotationReplyType.GROUP)) { if (isName(rt, AnnotationReplyType.GROUP)) {

View File

@ -2071,7 +2071,7 @@ class PopupAnnotationElement extends AnnotationElement {
container: this.container, container: this.container,
color: this.data.color, color: this.data.color,
titleObj: this.data.titleObj, titleObj: this.data.titleObj,
modificationDate: this.data.modificationDate, modificationDate: this.data.modificationDate || this.data.creationDate,
contentsObj: this.data.contentsObj, contentsObj: this.data.contentsObj,
richText: this.data.richText, richText: this.data.richText,
rect: this.data.rect, rect: this.data.rect,
@ -2212,14 +2212,17 @@ class PopupElement {
const header = document.createElement("span"); const header = document.createElement("span");
header.className = "header"; header.className = "header";
const title = document.createElement("h1"); if (this.#titleObj?.str) {
header.append(title); const title = document.createElement("span");
({ dir: title.dir, str: title.textContent } = this.#titleObj); title.className = "title";
header.append(title);
({ dir: title.dir, str: title.textContent } = this.#titleObj);
}
popup.append(header); popup.append(header);
if (this.#dateObj) { if (this.#dateObj) {
const modificationDate = document.createElement("time"); const modificationDate = document.createElement("time");
modificationDate.classList.add("popupDate"); modificationDate.className = "popupDate";
modificationDate.setAttribute( modificationDate.setAttribute(
"data-l10n-id", "data-l10n-id",
"pdfjs-annotation-date-time-string" "pdfjs-annotation-date-time-string"

View File

@ -730,3 +730,4 @@
!empty#hash.pdf !empty#hash.pdf
!bug1885505.pdf !bug1885505.pdf
!bug1974436.pdf !bug1974436.pdf
!firefox_logo.pdf

BIN
test/pdfs/firefox_logo.pdf Executable file

Binary file not shown.

View File

@ -12156,5 +12156,13 @@
"rounds": 1, "rounds": 1,
"type": "eq", "type": "eq",
"annotations": true "annotations": true
},
{
"id": "firefox_logo",
"file": "pdfs/firefox_logo.pdf",
"md5": "e212e0cec3e39907950c597782a42c3a",
"rounds": 1,
"type": "eq",
"annotations": true
} }
] ]

View File

@ -342,8 +342,9 @@
display: inline-block; display: inline-block;
} }
.popup > .header h1 { .popup > .header > .title {
display: inline; display: inline;
font-weight: bold;
} }
.popup > .header .popupDate { .popup > .header .popupDate {