mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2026-03-04 02:20:19 +01:00
refactor(link-layer): migrate to EmbedPDF v2.6.2 annotation state for link rendering and improve link handling (#5760)
This commit is contained in:
324
frontend/package-lock.json
generated
324
frontend/package-lock.json
generated
@@ -12,29 +12,29 @@
|
||||
"@atlaskit/pragmatic-drag-and-drop": "^1.7.7",
|
||||
"@cantoo/pdf-lib": "^2.5.3",
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@embedpdf/core": "^2.6.0",
|
||||
"@embedpdf/engines": "^2.6.0",
|
||||
"@embedpdf/models": "^2.6.0",
|
||||
"@embedpdf/plugin-annotation": "^2.6.0",
|
||||
"@embedpdf/plugin-attachment": "^2.6.0",
|
||||
"@embedpdf/plugin-bookmark": "^2.6.0",
|
||||
"@embedpdf/plugin-document-manager": "^2.6.0",
|
||||
"@embedpdf/plugin-export": "^2.6.0",
|
||||
"@embedpdf/plugin-history": "^2.6.0",
|
||||
"@embedpdf/plugin-interaction-manager": "^2.6.0",
|
||||
"@embedpdf/plugin-pan": "^2.6.0",
|
||||
"@embedpdf/plugin-print": "^2.6.0",
|
||||
"@embedpdf/plugin-redaction": "^2.6.0",
|
||||
"@embedpdf/plugin-render": "^2.6.0",
|
||||
"@embedpdf/plugin-rotate": "^2.6.0",
|
||||
"@embedpdf/plugin-scroll": "^2.6.0",
|
||||
"@embedpdf/plugin-search": "^2.6.0",
|
||||
"@embedpdf/plugin-selection": "^2.6.0",
|
||||
"@embedpdf/plugin-spread": "^2.6.0",
|
||||
"@embedpdf/plugin-thumbnail": "^2.6.0",
|
||||
"@embedpdf/plugin-tiling": "^2.6.0",
|
||||
"@embedpdf/plugin-viewport": "^2.6.0",
|
||||
"@embedpdf/plugin-zoom": "^2.6.0",
|
||||
"@embedpdf/core": "^2.6.2",
|
||||
"@embedpdf/engines": "^2.6.2",
|
||||
"@embedpdf/models": "^2.6.2",
|
||||
"@embedpdf/plugin-annotation": "^2.6.2",
|
||||
"@embedpdf/plugin-attachment": "^2.6.2",
|
||||
"@embedpdf/plugin-bookmark": "^2.6.2",
|
||||
"@embedpdf/plugin-document-manager": "^2.6.2",
|
||||
"@embedpdf/plugin-export": "^2.6.2",
|
||||
"@embedpdf/plugin-history": "^2.6.2",
|
||||
"@embedpdf/plugin-interaction-manager": "^2.6.2",
|
||||
"@embedpdf/plugin-pan": "^2.6.2",
|
||||
"@embedpdf/plugin-print": "^2.6.2",
|
||||
"@embedpdf/plugin-redaction": "^2.6.2",
|
||||
"@embedpdf/plugin-render": "^2.6.2",
|
||||
"@embedpdf/plugin-rotate": "^2.6.2",
|
||||
"@embedpdf/plugin-scroll": "^2.6.2",
|
||||
"@embedpdf/plugin-search": "^2.6.2",
|
||||
"@embedpdf/plugin-selection": "^2.6.2",
|
||||
"@embedpdf/plugin-spread": "^2.6.2",
|
||||
"@embedpdf/plugin-thumbnail": "^2.6.2",
|
||||
"@embedpdf/plugin-tiling": "^2.6.2",
|
||||
"@embedpdf/plugin-viewport": "^2.6.2",
|
||||
"@embedpdf/plugin-zoom": "^2.6.2",
|
||||
"@emotion/react": "^11.14.0",
|
||||
"@emotion/styled": "^11.14.1",
|
||||
"@iconify/react": "^6.0.2",
|
||||
@@ -570,13 +570,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/core": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/core/-/core-2.6.0.tgz",
|
||||
"integrity": "sha512-859GUvZ3BLpJuKTiwcPPMNn9CSlMaPjQ4yXnyQRngfbvDAiijIIpVLaC98B08Nx6QsUcD3cs/6+wkB888lNsDw==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/core/-/core-2.6.2.tgz",
|
||||
"integrity": "sha512-HTy2B7Q5hlNqtYo6lIudwycekG4x/iTESq05uYqENkvTclcZkzebnNirPPPPRcf3oT/u6Qvfj4mkx3z7wTSNUA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/engines": "2.6.0",
|
||||
"@embedpdf/models": "2.6.0"
|
||||
"@embedpdf/engines": "2.6.2",
|
||||
"@embedpdf/models": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"preact": "^10.26.4",
|
||||
@@ -587,9 +587,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/engines": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/engines/-/engines-2.6.0.tgz",
|
||||
"integrity": "sha512-zW3927u0wbFBD2tQLWbE45DEBIMkZyN7n5O2p70er6u7mP1XYEz7Ud9NxcPL/3b5MzDfPBTSyxM3T12e+ZeAxw==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/engines/-/engines-2.6.2.tgz",
|
||||
"integrity": "sha512-ZyyMVqZ8bnTNmgAziLhNywKhafVFbtLuC5AGcQqlAOQfyZqOWd240FdDGViQXAq4sfSp/NopirvIUtAKHoIrtg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/fonts-arabic": "1.0.0",
|
||||
@@ -599,8 +599,8 @@
|
||||
"@embedpdf/fonts-latin": "1.0.0",
|
||||
"@embedpdf/fonts-sc": "1.0.0",
|
||||
"@embedpdf/fonts-tc": "1.0.0",
|
||||
"@embedpdf/models": "2.6.0",
|
||||
"@embedpdf/pdfium": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2",
|
||||
"@embedpdf/pdfium": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"preact": "^10.26.4",
|
||||
@@ -653,31 +653,31 @@
|
||||
"license": "OFL-1.1"
|
||||
},
|
||||
"node_modules/@embedpdf/models": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/models/-/models-2.6.0.tgz",
|
||||
"integrity": "sha512-6zuoJE79WXyRXKhJXhl+8p4njuC1nxPpKYRIs54PRLgTkHOLaou+G+ZunEd99XOoVssHLCjxWBUpg46ihQwXDw==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/models/-/models-2.6.2.tgz",
|
||||
"integrity": "sha512-4mr1PIS5qR+HLKroUn9iU8qj+s/vptj82non94Ei0P6/yGG6GHv/E1lfALvd8rZ3FfHuF6V7Pa4SxS2WFDecYg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@embedpdf/pdfium": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/pdfium/-/pdfium-2.6.0.tgz",
|
||||
"integrity": "sha512-eYXU1VvVI0e9OqOzvsTcsU6YSLq9F7jcAiIbtMB+NxApvvH3kHz3FPEcf8ha2ZiLftF5OAD8K89SSE5GLE6t1A==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/pdfium/-/pdfium-2.6.2.tgz",
|
||||
"integrity": "sha512-LXqS+fSCQT1226X+XdrT6p0V2WR2cTDO3JzUix2v+9kl8IvlVfTWjkT5LVrOyS1poCsuySzd2GHz8jEweETgoQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@embedpdf/plugin-annotation": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-annotation/-/plugin-annotation-2.6.0.tgz",
|
||||
"integrity": "sha512-FJgGy6lhKrWsiJjh7jZ92NwMBob5GOwfYejQl28JFk6muEQORLtysz5gaeyMpMIyxnfjlf9Eqv8Z6LBBfGLGOA==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-annotation/-/plugin-annotation-2.6.2.tgz",
|
||||
"integrity": "sha512-3rOqty+jTzJu3fUvNPsaM2SmeV6K2J/DkzdgBZNVV3neahEl9v1DTJEkAxCgLI/fj6wBXEkJrKmmtDGoDlvVAg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/models": "2.6.0",
|
||||
"@embedpdf/utils": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2",
|
||||
"@embedpdf/utils": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@embedpdf/core": "2.6.0",
|
||||
"@embedpdf/plugin-history": "2.6.0",
|
||||
"@embedpdf/plugin-interaction-manager": "2.6.0",
|
||||
"@embedpdf/plugin-selection": "2.6.0",
|
||||
"@embedpdf/core": "2.6.2",
|
||||
"@embedpdf/plugin-history": "2.6.2",
|
||||
"@embedpdf/plugin-interaction-manager": "2.6.2",
|
||||
"@embedpdf/plugin-selection": "2.6.2",
|
||||
"preact": "^10.26.4",
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0",
|
||||
@@ -686,15 +686,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/plugin-attachment": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-attachment/-/plugin-attachment-2.6.0.tgz",
|
||||
"integrity": "sha512-6UZkj7jFWCruR69OPQFMqbJTgwdra4rnJSBfLA8yLxgz2zTsgt3owjfQDmlJvAQ7G1/rZM2T+EJeuozulj4NoQ==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-attachment/-/plugin-attachment-2.6.2.tgz",
|
||||
"integrity": "sha512-L14Gmo550Un5csOmWCe5tAjcv+11DlGVF6Rt2qRd3XtA4q4IehW4DpEpVf8viywBieI/WKcNqwpfUcWDhnDa9Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/models": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@embedpdf/core": "2.6.0",
|
||||
"@embedpdf/core": "2.6.2",
|
||||
"preact": "^10.26.4",
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0",
|
||||
@@ -703,15 +703,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/plugin-bookmark": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-bookmark/-/plugin-bookmark-2.6.0.tgz",
|
||||
"integrity": "sha512-4JmaFD+gFaLj8Bayi6Fm5qxMoRH+JUy+L3S6xk1KM8YWjJyzsoz9C2mHSXKJ0GBMgiOkjaBuJSWqLgMe/oz7OQ==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-bookmark/-/plugin-bookmark-2.6.2.tgz",
|
||||
"integrity": "sha512-kPfEoBiacsooUVxh5t4hSKl6O6woysfN75uXngHa2OkcyymzOgVNDe7UxTJxsvX8KikJ+dhRuuA1rJHsrsE7ig==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/models": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@embedpdf/core": "2.6.0",
|
||||
"@embedpdf/core": "2.6.2",
|
||||
"preact": "^10.26.4",
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0",
|
||||
@@ -720,15 +720,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/plugin-document-manager": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-document-manager/-/plugin-document-manager-2.6.0.tgz",
|
||||
"integrity": "sha512-fcx0JKDboEV8eQ4r++ksDHPDuUz40oOmtHDqxYLw6cpos0fqW0p55OP+fKp6LfC/bY7ULVDrmcEQf1cD9Qho4w==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-document-manager/-/plugin-document-manager-2.6.2.tgz",
|
||||
"integrity": "sha512-5oEDv4qXelyvCy9vOtNUZkMlS/sh5RtrSTG968T+km2/UijQ37AZO/h/Py5X5S0JOqZVkRhX5tXeXVn2K5NiHg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/models": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@embedpdf/core": "2.6.0",
|
||||
"@embedpdf/core": "2.6.2",
|
||||
"preact": "^10.26.4",
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0",
|
||||
@@ -737,15 +737,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/plugin-export": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-export/-/plugin-export-2.6.0.tgz",
|
||||
"integrity": "sha512-i1Xy7qUipVVLDPnnY22hm3RNMx33lvuNbCuPggql5Ws6WBLG9YhDsK+v0JVe2sDSlifa5SJwuBlMHZWPRTZyxg==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-export/-/plugin-export-2.6.2.tgz",
|
||||
"integrity": "sha512-lgbVVkHgSMwsUCn+1hpu1Ic6KQvfQlEwdHovAXzyrjvk2oqbQytRJbXL3bQsZWFFg6nqsIUb/4jwJwn/+n/yig==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/models": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@embedpdf/core": "2.6.0",
|
||||
"@embedpdf/core": "2.6.2",
|
||||
"preact": "^10.26.4",
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0",
|
||||
@@ -754,15 +754,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/plugin-history": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-history/-/plugin-history-2.6.0.tgz",
|
||||
"integrity": "sha512-cfVoBjkIbFiRsQu/cwPEi0rrTAF7jriAGzABWawnSTKYEPFrU3LDHO7TewgBz45kHl9pSwvRexaIdTR8ECIKbQ==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-history/-/plugin-history-2.6.2.tgz",
|
||||
"integrity": "sha512-MpTrxtNXjpdjUlmV+HnmPe9Abb/DX3k42JfFLwPhCXlF0BBuJnu300lb0qtZ02WXj8380/uL17Wb7ebSoVqIjA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/models": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@embedpdf/core": "2.6.0",
|
||||
"@embedpdf/core": "2.6.2",
|
||||
"preact": "^10.26.4",
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0",
|
||||
@@ -771,15 +771,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/plugin-interaction-manager": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-interaction-manager/-/plugin-interaction-manager-2.6.0.tgz",
|
||||
"integrity": "sha512-9bruF6M6GKVdABRTinHsZ+izf2tDQwDEcNI0CHVc5gurrz3CQfAGP2sJkv8uQrXyYTK3zV2Oq6zGknk7Hdx9mA==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-interaction-manager/-/plugin-interaction-manager-2.6.2.tgz",
|
||||
"integrity": "sha512-7LP7rMDDRWqojQb4E9/S1tWPp+fRfqTvHbb4kgMo14umTK26XWw/xazwf1UxchAruOTC5qjhraH4Bug0MoVyyQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/models": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@embedpdf/core": "2.6.0",
|
||||
"@embedpdf/core": "2.6.2",
|
||||
"preact": "^10.26.4",
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0",
|
||||
@@ -788,17 +788,17 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/plugin-pan": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-pan/-/plugin-pan-2.6.0.tgz",
|
||||
"integrity": "sha512-r8AXcXUy6NMYDaQeixScbeFfmZIvWpUUjx3gxjP4J90xfxXnuz/g/lnh4D2DBaiK4mt6crIVBpXU9IUwMIcUMQ==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-pan/-/plugin-pan-2.6.2.tgz",
|
||||
"integrity": "sha512-bqzGdr7fSuN0SPDKeaTr2MX24tB2rtoNyrGWZ2kOjuMUMQnNwcrBjK8XbWRjL7tcPLObGOR8vXwzt+hbSfZ3ig==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/models": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@embedpdf/core": "2.6.0",
|
||||
"@embedpdf/plugin-interaction-manager": "2.6.0",
|
||||
"@embedpdf/plugin-viewport": "2.6.0",
|
||||
"@embedpdf/core": "2.6.2",
|
||||
"@embedpdf/plugin-interaction-manager": "2.6.2",
|
||||
"@embedpdf/plugin-viewport": "2.6.2",
|
||||
"preact": "^10.26.4",
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0",
|
||||
@@ -807,15 +807,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/plugin-print": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-print/-/plugin-print-2.6.0.tgz",
|
||||
"integrity": "sha512-cgWRqVtRgCCLCn1ViuZEFr+ZJ3QI61/5s9tl3T9x81rwkBN4HT582BYzyRnLBzTMYKxkQZDr1WxfS8ctdlHEUQ==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-print/-/plugin-print-2.6.2.tgz",
|
||||
"integrity": "sha512-PaHl3h2eqMfzo6eviLvZuEGhAaZH877iF1RDTq1HAxpFgWeNKaJV3YcODDkSZwDzJW44jczTVstcEdN5Hk1b/w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/models": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@embedpdf/core": "2.6.0",
|
||||
"@embedpdf/core": "2.6.2",
|
||||
"preact": "^10.26.4",
|
||||
"react": ">=18.0.0",
|
||||
"react-dom": ">=18.0.0",
|
||||
@@ -824,20 +824,20 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/plugin-redaction": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-redaction/-/plugin-redaction-2.6.0.tgz",
|
||||
"integrity": "sha512-DdDnmOl9K0N4dpTeUohavxQyrfollhkjT+zdfkna3Fc7F4jfl3Vg6uKoGmT71A+Vp4uTGNLt6cNCscbJW9E9kQ==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-redaction/-/plugin-redaction-2.6.2.tgz",
|
||||
"integrity": "sha512-ASQdGAlAbpUY8kSvmSIRXpBRasjBEZXnPGhMsjHtYJgrLGeWeGfd18StH54TVaykYScu8gwI8XdzZJEnfM89GQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/models": "2.6.0",
|
||||
"@embedpdf/utils": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2",
|
||||
"@embedpdf/utils": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@embedpdf/core": "2.6.0",
|
||||
"@embedpdf/plugin-annotation": "2.6.0",
|
||||
"@embedpdf/plugin-history": "2.6.0",
|
||||
"@embedpdf/plugin-interaction-manager": "2.6.0",
|
||||
"@embedpdf/plugin-selection": "2.6.0",
|
||||
"@embedpdf/core": "2.6.2",
|
||||
"@embedpdf/plugin-annotation": "2.6.2",
|
||||
"@embedpdf/plugin-history": "2.6.2",
|
||||
"@embedpdf/plugin-interaction-manager": "2.6.2",
|
||||
"@embedpdf/plugin-selection": "2.6.2",
|
||||
"preact": "^10.26.4",
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0",
|
||||
@@ -846,15 +846,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/plugin-render": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-render/-/plugin-render-2.6.0.tgz",
|
||||
"integrity": "sha512-Rk4QCxDOzhQrvKPt/G3G+p5ELwnKFkC5ljHMd7ND23atR9E3wm5W3+Nx3FaAYYPrpfqQ7BrbKnfQ7SkUbDxS3w==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-render/-/plugin-render-2.6.2.tgz",
|
||||
"integrity": "sha512-6WK8kCNBxTHrjRPbLHQaou9ZrpaFW2f56Uu+zKbqXCD+tV7d8T9WAVQuqDJrWxjrUXUjWy1RC+KEBMGCftIHWA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/models": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@embedpdf/core": "2.6.0",
|
||||
"@embedpdf/core": "2.6.2",
|
||||
"preact": "^10.26.4",
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0",
|
||||
@@ -863,15 +863,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/plugin-rotate": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-rotate/-/plugin-rotate-2.6.0.tgz",
|
||||
"integrity": "sha512-zgF2S5cfkOxkOWrwoLQLN8scJgKBEhyhVOv/RNdeAKP6qE3h28AGRmDeMsekBDbiInlIxIHzynE5vVcTNf5EnQ==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-rotate/-/plugin-rotate-2.6.2.tgz",
|
||||
"integrity": "sha512-g9JUMbIEm91igKIVe8tmccHDI0jBtcYzaaHupyL2bQBByU+Zyz12k2FKbVn+sx0ppk8tYAbyAxeNkB/jNpQh2w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/models": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@embedpdf/core": "2.6.0",
|
||||
"@embedpdf/core": "2.6.2",
|
||||
"preact": "^10.26.4",
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0",
|
||||
@@ -880,16 +880,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/plugin-scroll": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-scroll/-/plugin-scroll-2.6.0.tgz",
|
||||
"integrity": "sha512-BEgSy6cs9+MLCS0Z3/FYMdA4Ygt6ddYIAg28XlF20kN3tLj8BQUo5qx6adI+SlwrFFGY52VAjjK7VSBuGfn19g==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-scroll/-/plugin-scroll-2.6.2.tgz",
|
||||
"integrity": "sha512-jshTwq69zvotGWMTDdxY+EYR/FBxPfu15fVo6YgYTSjUFm6IJL2z4XIvCB5pdHHHwXV1gTpi8W4FV3/2LXCjnA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/models": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@embedpdf/core": "2.6.0",
|
||||
"@embedpdf/plugin-viewport": "2.6.0",
|
||||
"@embedpdf/core": "2.6.2",
|
||||
"@embedpdf/plugin-viewport": "2.6.2",
|
||||
"preact": "^10.26.4",
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0",
|
||||
@@ -898,15 +898,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/plugin-search": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-search/-/plugin-search-2.6.0.tgz",
|
||||
"integrity": "sha512-GSzJkmuK9LE7LmlTwnDl71KdD9prHlCjgFs5Tm0K8qjELOSH+oduFXusIuf654+UQveDYczpzBVUcqb4yBf1xA==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-search/-/plugin-search-2.6.2.tgz",
|
||||
"integrity": "sha512-o4vYsqjGctDjiwP6+wrRndQoU728wW7Xyxr7mvAIQXlg0/AFBewKXbrX64bhGvVPOTPLpwPFcGBVK073OnaVCQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/models": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@embedpdf/core": "2.6.0",
|
||||
"@embedpdf/core": "2.6.2",
|
||||
"preact": "^10.26.4",
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0",
|
||||
@@ -915,17 +915,17 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/plugin-selection": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-selection/-/plugin-selection-2.6.0.tgz",
|
||||
"integrity": "sha512-VrW0duVxLwaquInwmuNDMz8o0tfCDwe3j81fvTUDW/s7KqnzFbxK7vEuq5TEtxWuSng2DXxyX3r1ntCm4X/NCg==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-selection/-/plugin-selection-2.6.2.tgz",
|
||||
"integrity": "sha512-btTRcaq+smbkqvcYmBa7+hK50eGoDOaepUma6Og2KCEIS90ZOEAChKY+KJq6axKHDg153/9kUwB1HJ6jTUUz4w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/models": "2.6.0",
|
||||
"@embedpdf/utils": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2",
|
||||
"@embedpdf/utils": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@embedpdf/core": "2.6.0",
|
||||
"@embedpdf/plugin-interaction-manager": "2.6.0",
|
||||
"@embedpdf/core": "2.6.2",
|
||||
"@embedpdf/plugin-interaction-manager": "2.6.2",
|
||||
"preact": "^10.26.4",
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0",
|
||||
@@ -934,15 +934,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/plugin-spread": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-spread/-/plugin-spread-2.6.0.tgz",
|
||||
"integrity": "sha512-0mzPCJlw1X7jWeDg5JssU6/HCFtyOP7scEdbIaASYzofGXa2Rj8/+L+UDBrb+KTF6CR4X6fEfeNmxWmAatOAWQ==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-spread/-/plugin-spread-2.6.2.tgz",
|
||||
"integrity": "sha512-JmMhUsHrZ7zeVbpk6xQQlD7BEpvkGWMZG1CC50Il4l7hFTlG+5InqhOpdr5aa2dQRKWv9w0UB7G/wqyB8UciuA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/models": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@embedpdf/core": "2.6.0",
|
||||
"@embedpdf/core": "2.6.2",
|
||||
"preact": "^10.26.4",
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0",
|
||||
@@ -951,16 +951,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/plugin-thumbnail": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-thumbnail/-/plugin-thumbnail-2.6.0.tgz",
|
||||
"integrity": "sha512-Sj4jCV1MNk+19zKWX4KfSl5c0YHrqVG83pEYfqexjSkSX7y7HRwAOtMBtNd3uLInPPSBnzDxj+KlJlIe8RPPJw==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-thumbnail/-/plugin-thumbnail-2.6.2.tgz",
|
||||
"integrity": "sha512-V5Ae9EBnVvhuNzQZzAUcoQGpA2G6nKe1gdAxzVUYhSYzpvW+Ld2dKG2ktEMBE4gZ5sXKV/tlHfON/HiP3hDm1g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/models": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@embedpdf/core": "2.6.0",
|
||||
"@embedpdf/plugin-render": "2.6.0",
|
||||
"@embedpdf/core": "2.6.2",
|
||||
"@embedpdf/plugin-render": "2.6.2",
|
||||
"preact": "^10.26.4",
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0",
|
||||
@@ -969,18 +969,18 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/plugin-tiling": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-tiling/-/plugin-tiling-2.6.0.tgz",
|
||||
"integrity": "sha512-qyiHWljryHWQ7uzip2WDg4x28o/1QM0wh9oIyz5WlBnrDaK6bLJGsWUym5P6WfLp0Y8h6GFAslNNcgjBv6E3qw==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-tiling/-/plugin-tiling-2.6.2.tgz",
|
||||
"integrity": "sha512-F0sqBp7noczTFpy7yCOiAoJf0ndW7cfyfXXyYXuMLL9916QFzobZi1AsXfqRamSYReJTNCF/Yor57j8jvm90MA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/models": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@embedpdf/core": "2.6.0",
|
||||
"@embedpdf/plugin-render": "2.6.0",
|
||||
"@embedpdf/plugin-scroll": "2.6.0",
|
||||
"@embedpdf/plugin-viewport": "2.6.0",
|
||||
"@embedpdf/core": "2.6.2",
|
||||
"@embedpdf/plugin-render": "2.6.2",
|
||||
"@embedpdf/plugin-scroll": "2.6.2",
|
||||
"@embedpdf/plugin-viewport": "2.6.2",
|
||||
"preact": "^10.26.4",
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0",
|
||||
@@ -989,15 +989,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/plugin-viewport": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-viewport/-/plugin-viewport-2.6.0.tgz",
|
||||
"integrity": "sha512-Ea7s+LivQ4ph01mVngU2tu2Ni/zulxzIyiifCpMaBMHmvjGFQjJcNNYHR90YuM8keto82KCszxdNDuAEEzT6Wg==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-viewport/-/plugin-viewport-2.6.2.tgz",
|
||||
"integrity": "sha512-uHLeKQqyKpUAJcbpsJ8P/c2qU6dTKYAC9l/xviURSABqKLw0IC3DLw6aTPZtzCFEsKiIVFZDwjz/LUt+DZaNHQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/models": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@embedpdf/core": "2.6.0",
|
||||
"@embedpdf/core": "2.6.2",
|
||||
"preact": "^10.26.4",
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0",
|
||||
@@ -1006,17 +1006,17 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/plugin-zoom": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-zoom/-/plugin-zoom-2.6.0.tgz",
|
||||
"integrity": "sha512-2XUgasN2ZQm2MgpB6ls/re/SKhsREvt2D1gIcvJgXvGkene0NcpxGNIRi/+JN7W0fw4x3QtwLQtyF+/0uMgPmg==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/plugin-zoom/-/plugin-zoom-2.6.2.tgz",
|
||||
"integrity": "sha512-lw4JG+gDLeIJYyFzsmsNZcN1kwm+5qAvOPMWQ+CA6zMaNDKV5BwE3c4JRDGwqWF+syK0yvuDh9sjT50h+LSwwg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@embedpdf/models": "2.6.0"
|
||||
"@embedpdf/models": "2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@embedpdf/core": "2.6.0",
|
||||
"@embedpdf/plugin-scroll": "2.6.0",
|
||||
"@embedpdf/plugin-viewport": "2.6.0",
|
||||
"@embedpdf/core": "2.6.2",
|
||||
"@embedpdf/plugin-scroll": "2.6.2",
|
||||
"@embedpdf/plugin-viewport": "2.6.2",
|
||||
"preact": "^10.26.4",
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0",
|
||||
@@ -1025,9 +1025,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@embedpdf/utils": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/utils/-/utils-2.6.0.tgz",
|
||||
"integrity": "sha512-FT6U6L3Et688urUTyISpYH05w4sG+WzoWxaI7aPU4ieh4c/vVgadUtjZj/QCC8v+DebPYRAX1gpUY7e0Y0HlTQ==",
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@embedpdf/utils/-/utils-2.6.2.tgz",
|
||||
"integrity": "sha512-+sY221n1rb1Q3JzFe8tZ+TISvjVzOt5kdnZbd6vEWFaUpS577x65T1Uk9ngb3GZt7o9DmC7Of5XdMqZiray2ow==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"preact": "^10.26.4",
|
||||
|
||||
@@ -7,29 +7,29 @@
|
||||
"dependencies": {
|
||||
"@atlaskit/pragmatic-drag-and-drop": "^1.7.7",
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@embedpdf/core": "^2.6.0",
|
||||
"@embedpdf/engines": "^2.6.0",
|
||||
"@embedpdf/models": "^2.6.0",
|
||||
"@embedpdf/plugin-annotation": "^2.6.0",
|
||||
"@embedpdf/plugin-attachment": "^2.6.0",
|
||||
"@embedpdf/plugin-bookmark": "^2.6.0",
|
||||
"@embedpdf/plugin-export": "^2.6.0",
|
||||
"@embedpdf/plugin-history": "^2.6.0",
|
||||
"@embedpdf/plugin-document-manager": "^2.6.0",
|
||||
"@embedpdf/plugin-interaction-manager": "^2.6.0",
|
||||
"@embedpdf/plugin-pan": "^2.6.0",
|
||||
"@embedpdf/plugin-print": "^2.6.0",
|
||||
"@embedpdf/plugin-redaction": "^2.6.0",
|
||||
"@embedpdf/plugin-render": "^2.6.0",
|
||||
"@embedpdf/plugin-rotate": "^2.6.0",
|
||||
"@embedpdf/plugin-scroll": "^2.6.0",
|
||||
"@embedpdf/plugin-search": "^2.6.0",
|
||||
"@embedpdf/plugin-selection": "^2.6.0",
|
||||
"@embedpdf/plugin-spread": "^2.6.0",
|
||||
"@embedpdf/plugin-thumbnail": "^2.6.0",
|
||||
"@embedpdf/plugin-tiling": "^2.6.0",
|
||||
"@embedpdf/plugin-viewport": "^2.6.0",
|
||||
"@embedpdf/plugin-zoom": "^2.6.0",
|
||||
"@embedpdf/core": "^2.6.2",
|
||||
"@embedpdf/engines": "^2.6.2",
|
||||
"@embedpdf/models": "^2.6.2",
|
||||
"@embedpdf/plugin-annotation": "^2.6.2",
|
||||
"@embedpdf/plugin-attachment": "^2.6.2",
|
||||
"@embedpdf/plugin-bookmark": "^2.6.2",
|
||||
"@embedpdf/plugin-export": "^2.6.2",
|
||||
"@embedpdf/plugin-history": "^2.6.2",
|
||||
"@embedpdf/plugin-document-manager": "^2.6.2",
|
||||
"@embedpdf/plugin-interaction-manager": "^2.6.2",
|
||||
"@embedpdf/plugin-pan": "^2.6.2",
|
||||
"@embedpdf/plugin-print": "^2.6.2",
|
||||
"@embedpdf/plugin-redaction": "^2.6.2",
|
||||
"@embedpdf/plugin-render": "^2.6.2",
|
||||
"@embedpdf/plugin-rotate": "^2.6.2",
|
||||
"@embedpdf/plugin-scroll": "^2.6.2",
|
||||
"@embedpdf/plugin-search": "^2.6.2",
|
||||
"@embedpdf/plugin-selection": "^2.6.2",
|
||||
"@embedpdf/plugin-spread": "^2.6.2",
|
||||
"@embedpdf/plugin-thumbnail": "^2.6.2",
|
||||
"@embedpdf/plugin-tiling": "^2.6.2",
|
||||
"@embedpdf/plugin-viewport": "^2.6.2",
|
||||
"@embedpdf/plugin-zoom": "^2.6.2",
|
||||
"@emotion/react": "^11.14.0",
|
||||
"@emotion/styled": "^11.14.1",
|
||||
"@iconify/react": "^6.0.2",
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import React, { useCallback, useState, useMemo, useRef } from 'react';
|
||||
import { useDocumentState } from '@embedpdf/core/react';
|
||||
import { useScroll } from '@embedpdf/plugin-scroll/react';
|
||||
import { useAnnotationCapability } from '@embedpdf/plugin-annotation/react';
|
||||
import { PdfAnnotationSubtype } from '@embedpdf/models';
|
||||
import { usePdfLibLinks } from '@app/hooks/usePdfLibLinks';
|
||||
import type { PdfLibLink } from '@app/utils/pdfLinkUtils';
|
||||
import { useAnnotation } from '@embedpdf/plugin-annotation/react';
|
||||
import { PdfAnnotationSubtype, PdfActionType, type PdfLinkAnnoObject } from '@embedpdf/models';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Inline SVG icons (thin-stroke, modern)
|
||||
@@ -67,23 +65,41 @@ function truncateUrl(url: string, maxLen = 32): string {
|
||||
}
|
||||
}
|
||||
|
||||
function getLinkLabel(link: PdfLibLink): string {
|
||||
if (link.type === 'internal' && link.targetPage !== undefined) {
|
||||
return `Page ${link.targetPage + 1}`;
|
||||
}
|
||||
if (link.type === 'external' && link.uri) {
|
||||
return truncateUrl(link.uri);
|
||||
function getLinkLabel(annotationLink: PdfLinkAnnoObject): string {
|
||||
if (!annotationLink.target) return 'Open Link';
|
||||
|
||||
if (annotationLink.target.type === 'action') {
|
||||
const action = annotationLink.target.action;
|
||||
if (action.type === PdfActionType.URI) return truncateUrl(action.uri);
|
||||
if (action.type === PdfActionType.Goto) return `Page ${action.destination.pageIndex + 1}`;
|
||||
if (action.type === PdfActionType.RemoteGoto) return `Page ${action.destination.pageIndex + 1}`;
|
||||
} else if (annotationLink.target.type === 'destination') {
|
||||
return `Page ${annotationLink.target.destination.pageIndex + 1}`;
|
||||
}
|
||||
|
||||
return 'Open Link';
|
||||
}
|
||||
|
||||
function isInternalLink(annotationLink: PdfLinkAnnoObject): boolean {
|
||||
if (!annotationLink.target) return false;
|
||||
if (annotationLink.target.type === 'destination') return true;
|
||||
if (annotationLink.target.type === 'action') {
|
||||
const { type } = annotationLink.target.action;
|
||||
return type === PdfActionType.Goto || type === PdfActionType.RemoteGoto;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// LinkToolbar
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
interface LinkToolbarProps {
|
||||
link: PdfLibLink;
|
||||
annotationLink: PdfLinkAnnoObject;
|
||||
scale: number;
|
||||
flipped: boolean;
|
||||
onNavigate: (link: PdfLibLink) => void;
|
||||
onDelete: (link: PdfLibLink) => void;
|
||||
onNavigate: (annotationLink: PdfLinkAnnoObject) => void;
|
||||
onDelete: (annotationLink: PdfLinkAnnoObject) => void;
|
||||
onMouseEnter: () => void;
|
||||
onMouseLeave: () => void;
|
||||
}
|
||||
@@ -92,14 +108,14 @@ const TOOLBAR_HEIGHT = 32;
|
||||
const TOOLBAR_GAP = 8;
|
||||
|
||||
const LinkToolbar: React.FC<LinkToolbarProps> = React.memo(
|
||||
({ link, scale, flipped, onNavigate, onDelete, onMouseEnter, onMouseLeave }) => {
|
||||
const centerX = (link.rect.x + link.rect.width / 2) * scale;
|
||||
({ annotationLink, scale, flipped, onNavigate, onDelete, onMouseEnter, onMouseLeave }) => {
|
||||
const centerX = (annotationLink.rect.origin.x + annotationLink.rect.size.width / 2) * scale;
|
||||
const topY = flipped
|
||||
? (link.rect.y + link.rect.height) * scale + TOOLBAR_GAP
|
||||
: link.rect.y * scale - TOOLBAR_HEIGHT - TOOLBAR_GAP;
|
||||
? (annotationLink.rect.origin.y + annotationLink.rect.size.height) * scale + TOOLBAR_GAP
|
||||
: annotationLink.rect.origin.y * scale - TOOLBAR_HEIGHT - TOOLBAR_GAP;
|
||||
|
||||
const isInternal = link.type === 'internal' && link.targetPage !== undefined;
|
||||
const label = getLinkLabel(link);
|
||||
const internal = isInternalLink(annotationLink);
|
||||
const label = getLinkLabel(annotationLink);
|
||||
|
||||
return (
|
||||
<div
|
||||
@@ -114,7 +130,7 @@ const LinkToolbar: React.FC<LinkToolbarProps> = React.memo(
|
||||
className="pdf-link-toolbar-btn pdf-link-toolbar-btn--delete"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onDelete(link);
|
||||
onDelete(annotationLink);
|
||||
}}
|
||||
aria-label="Delete link"
|
||||
title="Delete link"
|
||||
@@ -130,12 +146,12 @@ const LinkToolbar: React.FC<LinkToolbarProps> = React.memo(
|
||||
className="pdf-link-toolbar-btn pdf-link-toolbar-btn--go"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onNavigate(link);
|
||||
onNavigate(annotationLink);
|
||||
}}
|
||||
aria-label={isInternal ? `Go to page ${(link.targetPage ?? 0) + 1}` : 'Open link'}
|
||||
title={isInternal ? `Go to page ${(link.targetPage ?? 0) + 1}` : link.uri ?? 'Open link'}
|
||||
aria-label={internal ? `Go to page ${annotationLink.target?.type === 'destination' ? annotationLink.target.destination.pageIndex + 1 : ''}` : 'Open link'}
|
||||
title={label}
|
||||
>
|
||||
{isInternal ? <PageIcon /> : <ExternalLinkIcon />}
|
||||
{internal ? <PageIcon /> : <ExternalLinkIcon />}
|
||||
<span className="pdf-link-toolbar-label">{label}</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -145,47 +161,47 @@ const LinkToolbar: React.FC<LinkToolbarProps> = React.memo(
|
||||
|
||||
LinkToolbar.displayName = 'LinkToolbar';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// LinkLayer
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
interface LinkLayerProps {
|
||||
documentId: string;
|
||||
pageIndex: number;
|
||||
_pageWidth: number;
|
||||
_pageHeight: number;
|
||||
/** Blob/object URL of the current PDF (needed by pdf-lib). */
|
||||
pdfUrl: string | null;
|
||||
}
|
||||
|
||||
export const LinkLayer: React.FC<LinkLayerProps> = ({
|
||||
documentId,
|
||||
pageIndex,
|
||||
_pageWidth,
|
||||
_pageHeight,
|
||||
pdfUrl,
|
||||
}) => {
|
||||
export const LinkLayer: React.FC<LinkLayerProps> = ({ documentId, pageIndex }) => {
|
||||
const { provides: scroll } = useScroll(documentId);
|
||||
const { provides: annotation } = useAnnotationCapability();
|
||||
const { state, provides: scope } = useAnnotation(documentId);
|
||||
const documentState = useDocumentState(documentId);
|
||||
|
||||
// State
|
||||
const [hoveredLinkId, setHoveredLinkId] = useState<string | null>(null);
|
||||
const [deletedLinkIds, setDeletedLinkIds] = useState<Set<string>>(new Set());
|
||||
const leaveTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
// pdf-lib extraction
|
||||
const { links } = usePdfLibLinks(pdfUrl, pageIndex);
|
||||
// Extract link annotations for this page from EmbedPDF annotation state
|
||||
const linkAnnotations = useMemo<PdfLinkAnnoObject[]>(() => {
|
||||
if (!state) return [];
|
||||
const uids = state.pages[pageIndex] ?? [];
|
||||
const result: PdfLinkAnnoObject[] = [];
|
||||
for (const uid of uids) {
|
||||
const ta = state.byUid[uid];
|
||||
if (
|
||||
ta &&
|
||||
ta.commitState !== 'deleted' &&
|
||||
ta.object.type === PdfAnnotationSubtype.LINK
|
||||
) {
|
||||
const annotationLink = ta.object as PdfLinkAnnoObject;
|
||||
if (annotationLink.rect.size.width > 0 && annotationLink.rect.size.height > 0) {
|
||||
result.push(annotationLink);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}, [state, pageIndex]);
|
||||
|
||||
// EmbedPDF scale factor
|
||||
// EmbedPDF scale factor (annotation rects are in PDF points at scale 1)
|
||||
const scale = documentState?.scale ?? 1;
|
||||
|
||||
// Filter visible, non-deleted links
|
||||
const visibleLinks = useMemo(
|
||||
() =>
|
||||
links.filter(
|
||||
(l) => l.rect.width > 0 && l.rect.height > 0 && !deletedLinkIds.has(l.id),
|
||||
),
|
||||
[links, deletedLinkIds],
|
||||
);
|
||||
|
||||
|
||||
const clearLeaveTimer = useCallback(() => {
|
||||
if (leaveTimerRef.current) {
|
||||
clearTimeout(leaveTimerRef.current);
|
||||
@@ -201,9 +217,9 @@ export const LinkLayer: React.FC<LinkLayerProps> = ({
|
||||
}, [clearLeaveTimer]);
|
||||
|
||||
const handleLinkMouseEnter = useCallback(
|
||||
(linkId: string) => {
|
||||
(id: string) => {
|
||||
clearLeaveTimer();
|
||||
setHoveredLinkId(linkId);
|
||||
setHoveredLinkId(id);
|
||||
},
|
||||
[clearLeaveTimer],
|
||||
);
|
||||
@@ -221,111 +237,87 @@ export const LinkLayer: React.FC<LinkLayerProps> = ({
|
||||
}, [startLeaveTimer]);
|
||||
|
||||
const handleNavigate = useCallback(
|
||||
(link: PdfLibLink) => {
|
||||
if (link.type === 'internal' && link.targetPage !== undefined && scroll) {
|
||||
(annotationLink: PdfLinkAnnoObject) => {
|
||||
if (!annotationLink.target) {
|
||||
setHoveredLinkId(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (annotationLink.target.type === 'destination' && scroll) {
|
||||
scroll.scrollToPage({
|
||||
pageNumber: link.targetPage + 1,
|
||||
pageNumber: annotationLink.target.destination.pageIndex + 1,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
} else if (link.uri) {
|
||||
try {
|
||||
const url = new URL(link.uri, window.location.href);
|
||||
if (['http:', 'https:', 'mailto:'].includes(url.protocol)) {
|
||||
window.open(link.uri, '_blank', 'noopener,noreferrer');
|
||||
} else {
|
||||
console.warn('[LinkLayer] Blocked unsafe URL protocol:', url.protocol);
|
||||
} else if (annotationLink.target.type === 'action') {
|
||||
const action = annotationLink.target.action;
|
||||
if (action.type === PdfActionType.Goto && scroll) {
|
||||
scroll.scrollToPage({
|
||||
pageNumber: action.destination.pageIndex + 1,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
} else if (action.type === PdfActionType.RemoteGoto && scroll) {
|
||||
scroll.scrollToPage({
|
||||
pageNumber: action.destination.pageIndex + 1,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
} else if (action.type === PdfActionType.URI) {
|
||||
const uri = action.uri;
|
||||
try {
|
||||
const url = new URL(uri, window.location.href);
|
||||
if (['http:', 'https:', 'mailto:'].includes(url.protocol)) {
|
||||
window.open(uri, '_blank', 'noopener,noreferrer');
|
||||
} else {
|
||||
console.warn('[LinkLayer] Blocked unsafe URL protocol:', url.protocol);
|
||||
}
|
||||
} catch {
|
||||
window.open(uri, '_blank', 'noopener,noreferrer');
|
||||
}
|
||||
} catch {
|
||||
window.open(link.uri, '_blank', 'noopener,noreferrer');
|
||||
}
|
||||
}
|
||||
|
||||
setHoveredLinkId(null);
|
||||
},
|
||||
[scroll],
|
||||
);
|
||||
|
||||
const handleDelete = useCallback(
|
||||
async (link: PdfLibLink) => {
|
||||
setDeletedLinkIds((prev) => new Set(prev).add(link.id));
|
||||
(annotationLink: PdfLinkAnnoObject) => {
|
||||
setHoveredLinkId(null);
|
||||
|
||||
if (!annotation) return;
|
||||
|
||||
try {
|
||||
const result = annotation.getPageAnnotations({ pageIndex });
|
||||
|
||||
let pageAnnotations: any[] = [];
|
||||
if (result && typeof (result as any).toPromise === 'function') {
|
||||
pageAnnotations = await (result as any).toPromise();
|
||||
} else if (result && typeof (result as any).then === 'function') {
|
||||
pageAnnotations = await (result as unknown as Promise<any[]>);
|
||||
} else if (Array.isArray(result)) {
|
||||
pageAnnotations = result;
|
||||
}
|
||||
|
||||
const match = pageAnnotations.find((ann: any) => {
|
||||
if (
|
||||
ann.type !== 2 &&
|
||||
ann.type !== PdfAnnotationSubtype.LINK
|
||||
)
|
||||
return false;
|
||||
if (!ann.rect) return false;
|
||||
|
||||
// EmbedPDF rects: { origin: { x, y }, size: { width, height } }
|
||||
const r = ann.rect;
|
||||
const tol = 2; // tolerance in PDF points
|
||||
return (
|
||||
Math.abs((r.origin?.x ?? r.x ?? 0) - link.rect.x) <= tol &&
|
||||
Math.abs((r.origin?.y ?? r.y ?? 0) - link.rect.y) <= tol &&
|
||||
Math.abs((r.size?.width ?? r.width ?? 0) - link.rect.width) <= tol &&
|
||||
Math.abs((r.size?.height ?? r.height ?? 0) - link.rect.height) <= tol
|
||||
);
|
||||
});
|
||||
|
||||
if (match?.id) {
|
||||
// Use EmbedPDF's native deletion (integrates with history / export)
|
||||
if (typeof (annotation as any).deleteAnnotation === 'function') {
|
||||
(annotation as any).deleteAnnotation(pageIndex, match.id);
|
||||
} else if (typeof (annotation as any).purgeAnnotation === 'function') {
|
||||
(annotation as any).purgeAnnotation(pageIndex, match.id);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('[LinkLayer] Could not delete annotation via EmbedPDF:', e);
|
||||
}
|
||||
if (!scope) return;
|
||||
scope.deleteAnnotation(pageIndex, annotationLink.id);
|
||||
},
|
||||
[annotation, pageIndex],
|
||||
[scope, pageIndex],
|
||||
);
|
||||
|
||||
if (visibleLinks.length === 0) return null;
|
||||
if (linkAnnotations.length === 0) return null;
|
||||
|
||||
return (
|
||||
<div
|
||||
className="absolute inset-0"
|
||||
style={{ pointerEvents: 'none', zIndex: 10 }}
|
||||
>
|
||||
{visibleLinks.map((link) => {
|
||||
const isHovered = hoveredLinkId === link.id;
|
||||
const left = link.rect.x * scale;
|
||||
const top = link.rect.y * scale;
|
||||
const width = link.rect.width * scale;
|
||||
const height = link.rect.height * scale;
|
||||
{linkAnnotations.map((annotationLink) => {
|
||||
const isHovered = hoveredLinkId === annotationLink.id;
|
||||
const left = annotationLink.rect.origin.x * scale;
|
||||
const top = annotationLink.rect.origin.y * scale;
|
||||
const width = annotationLink.rect.size.width * scale;
|
||||
const height = annotationLink.rect.size.height * scale;
|
||||
|
||||
// Flip toolbar below if link is near the top of the page
|
||||
const flipped = link.rect.y * scale < TOOLBAR_HEIGHT + TOOLBAR_GAP + 4;
|
||||
const flipped = annotationLink.rect.origin.y * scale < TOOLBAR_HEIGHT + TOOLBAR_GAP + 4;
|
||||
|
||||
return (
|
||||
<React.Fragment key={link.id}>
|
||||
<React.Fragment key={annotationLink.id}>
|
||||
{/* Hit-area overlay */}
|
||||
<a
|
||||
href="#"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
handleNavigate(link);
|
||||
handleNavigate(annotationLink);
|
||||
}}
|
||||
onMouseDown={(e) => e.stopPropagation()}
|
||||
onMouseEnter={() => handleLinkMouseEnter(link.id)}
|
||||
onMouseEnter={() => handleLinkMouseEnter(annotationLink.id)}
|
||||
onMouseLeave={handleLinkMouseLeave}
|
||||
className={`pdf-link-overlay${isHovered ? ' pdf-link-overlay--active' : ''}`}
|
||||
style={{
|
||||
@@ -338,13 +330,13 @@ export const LinkLayer: React.FC<LinkLayerProps> = ({
|
||||
}}
|
||||
role="link"
|
||||
tabIndex={0}
|
||||
aria-label={getLinkLabel(link)}
|
||||
aria-label={getLinkLabel(annotationLink)}
|
||||
/>
|
||||
|
||||
{/* Floating toolbar */}
|
||||
{isHovered && (
|
||||
<LinkToolbar
|
||||
link={link}
|
||||
annotationLink={annotationLink}
|
||||
scale={scale}
|
||||
flipped={flipped}
|
||||
onNavigate={handleNavigate}
|
||||
|
||||
@@ -765,13 +765,10 @@ export function LocalEmbedPDF({ file, url, fileName, enableAnnotations = false,
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* LinkLayer – uses pdf-lib for link extraction, rendered last for click priority */}
|
||||
{/* LinkLayer – uses EmbedPDF annotation state for link rendering */}
|
||||
<LinkLayer
|
||||
documentId={documentId}
|
||||
pageIndex={pageIndex}
|
||||
_pageWidth={width}
|
||||
_pageHeight={height}
|
||||
pdfUrl={pdfUrl}
|
||||
/>
|
||||
</div>
|
||||
</PagePointerProvider>
|
||||
|
||||
Reference in New Issue
Block a user