mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
[Editor] Add the possibility to update an existing annotation with some new properties when saving or printing
This commit is contained in:
parent
f8a84a6f03
commit
1a047f843c
6 changed files with 167 additions and 6 deletions
|
@ -279,6 +279,23 @@ class Ref {
|
|||
return `${this.num}R${this.gen}`;
|
||||
}
|
||||
|
||||
static fromString(str) {
|
||||
const ref = RefCache[str];
|
||||
if (ref) {
|
||||
return ref;
|
||||
}
|
||||
const m = /^(\d+)R(\d*)$/.exec(str);
|
||||
if (!m || m[1] === "0") {
|
||||
return null;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
return (RefCache[str] = new Ref(
|
||||
parseInt(m[1]),
|
||||
!m[2] ? 0 : parseInt(m[2])
|
||||
));
|
||||
}
|
||||
|
||||
static get(num, gen) {
|
||||
const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue