1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Annotations - Avoid empty value in text field when storage contains something for it (bug 1719148)

- it aims to fix https://bugzilla.mozilla.org/show_bug.cgi?id=1719148;
  - JS can set a property for a non-rendered annotation using the annotationStorage but the other unset default properties must be used when the annotation is finally rendered;
  - so this patch just adds the properties already set in the annotationStorage to the default value.
This commit is contained in:
Calixte Denizet 2021-09-18 14:55:38 +02:00
parent 7082ff9bf8
commit eb762ad624
2 changed files with 24 additions and 1 deletions

View file

@ -42,7 +42,12 @@ class AnnotationStorage {
* @returns {Object}
*/
getValue(key, defaultValue) {
return this._storage.get(key) ?? defaultValue;
const value = this._storage.get(key);
if (value === undefined) {
return defaultValue;
}
return Object.assign(defaultValue, value);
}
/**