mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #2552 from overleaf/jel-update-pdfjs
Update PDF.js GitOrigin-RevId: 231ab11eccc32e4eddc87fc8829dd28843e41a51
This commit is contained in:
parent
353625be51
commit
222ba263ff
4 changed files with 24 additions and 23 deletions
|
@ -22,7 +22,6 @@ define(['base', './pdfJsLoader'], (App, PDFJS) =>
|
|||
// App = angular.module 'PDFRenderer', ['pdfAnnotations', 'pdfTextLayer']
|
||||
|
||||
App.factory('PDFRenderer', function(
|
||||
$q,
|
||||
$timeout,
|
||||
pdfAnnotations,
|
||||
pdfTextLayer,
|
||||
|
@ -76,11 +75,11 @@ define(['base', './pdfJsLoader'], (App, PDFJS) =>
|
|||
disableStream: !!this.options.disableAutoFetch
|
||||
})
|
||||
this.pdfjs.onProgress = this.options.progressCallback
|
||||
this.document = $q.when(this.pdfjs)
|
||||
this.document = this.pdfjs
|
||||
this.navigateFn = this.options.navigateFn
|
||||
this.spinner = new pdfSpinner()
|
||||
this.resetState()
|
||||
this.document.then(pdfDocument => {
|
||||
this.document.promise.then(pdfDocument => {
|
||||
return pdfDocument.getDownloadInfo().then(() => {
|
||||
return this.options.loadedCallback()
|
||||
})
|
||||
|
@ -116,22 +115,24 @@ define(['base', './pdfJsLoader'], (App, PDFJS) =>
|
|||
}
|
||||
|
||||
getNumPages() {
|
||||
return this.document.then(pdfDocument => pdfDocument.numPages)
|
||||
return this.document.promise.then(pdfDocument => pdfDocument.numPages)
|
||||
}
|
||||
|
||||
getPage(pageNum) {
|
||||
return this.document.then(pdfDocument => pdfDocument.getPage(pageNum))
|
||||
return this.document.promise.then(pdfDocument =>
|
||||
pdfDocument.getPage(pageNum)
|
||||
)
|
||||
}
|
||||
|
||||
getPdfViewport(pageNum, scale) {
|
||||
if (scale == null) {
|
||||
;({ scale } = this)
|
||||
}
|
||||
return this.document.then(pdfDocument => {
|
||||
return this.document.promise.then(pdfDocument => {
|
||||
return pdfDocument.getPage(pageNum).then(
|
||||
function(page) {
|
||||
let viewport
|
||||
return (viewport = page.getViewport(scale))
|
||||
return (viewport = page.getViewport({ scale: scale }))
|
||||
},
|
||||
error => {
|
||||
return typeof this.errorCallback === 'function'
|
||||
|
@ -143,13 +144,13 @@ define(['base', './pdfJsLoader'], (App, PDFJS) =>
|
|||
}
|
||||
|
||||
getDestinations() {
|
||||
return this.document.then(pdfDocument =>
|
||||
return this.document.promise.then(pdfDocument =>
|
||||
pdfDocument.getDestinations()
|
||||
)
|
||||
}
|
||||
|
||||
getDestination(dest) {
|
||||
return this.document.then(
|
||||
return this.document.promise.then(
|
||||
pdfDocument => pdfDocument.getDestination(dest),
|
||||
error => {
|
||||
return typeof this.errorCallback === 'function'
|
||||
|
@ -160,7 +161,7 @@ define(['base', './pdfJsLoader'], (App, PDFJS) =>
|
|||
}
|
||||
|
||||
getPageIndex(ref) {
|
||||
return this.document.then(pdfDocument => {
|
||||
return this.document.promise.then(pdfDocument => {
|
||||
return pdfDocument.getPageIndex(ref).then(
|
||||
idx => idx,
|
||||
error => {
|
||||
|
@ -366,7 +367,7 @@ define(['base', './pdfJsLoader'], (App, PDFJS) =>
|
|||
return
|
||||
} // return from cancelled page load
|
||||
pageState.renderTask = this.doRender(element, pagenum, pageObject)
|
||||
return pageState.renderTask.then(
|
||||
return pageState.renderTask.promise.then(
|
||||
() => {
|
||||
// render task success
|
||||
this.clearIndicator(page)
|
||||
|
@ -409,7 +410,7 @@ define(['base', './pdfJsLoader'], (App, PDFJS) =>
|
|||
// when rendering was complete.
|
||||
element.canvas.replaceWith(canvas)
|
||||
|
||||
const viewport = page.getViewport(scale)
|
||||
const viewport = page.getViewport({ scale: scale })
|
||||
|
||||
const devicePixelRatio = window.devicePixelRatio || 1
|
||||
|
||||
|
@ -467,7 +468,7 @@ define(['base', './pdfJsLoader'], (App, PDFJS) =>
|
|||
|
||||
const textLayerTimeout = this.TEXTLAYER_TIMEOUT
|
||||
|
||||
result
|
||||
result.promise
|
||||
.then(function() {
|
||||
// page render success
|
||||
canvas.removeClass('pdfng-rendering')
|
||||
|
@ -508,7 +509,7 @@ define(['base', './pdfJsLoader'], (App, PDFJS) =>
|
|||
destroy() {
|
||||
this.shuttingDown = true
|
||||
this.resetState()
|
||||
return this.pdfjs.then(function(document) {
|
||||
return this.pdfjs.promise.then(function(document) {
|
||||
document.cleanup()
|
||||
return document.destroy()
|
||||
})
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
}
|
||||
.plv-text-layer > div {
|
||||
.plv-text-layer > span {
|
||||
color: transparent;
|
||||
position: absolute;
|
||||
line-height: 1;
|
||||
|
@ -25,9 +25,9 @@
|
|||
-ms-transform-origin: 0% 0%;
|
||||
transform-origin: 0% 0%;
|
||||
}
|
||||
.plv-text-layer > div::selection {
|
||||
background:rgba(0,0,255,0.3);
|
||||
.plv-text-layer > span::selection {
|
||||
background: rgba(0, 0, 255, 0.3);
|
||||
}
|
||||
.plv-text-layer > div::-moz-selection {
|
||||
background:rgba(0,0,255,0.3);
|
||||
.plv-text-layer > span::-moz-selection {
|
||||
background: rgba(0, 0, 255, 0.3);
|
||||
}
|
||||
|
|
6
services/web/package-lock.json
generated
6
services/web/package-lock.json
generated
|
@ -16716,9 +16716,9 @@
|
|||
}
|
||||
},
|
||||
"pdfjs-dist": {
|
||||
"version": "2.0.943",
|
||||
"resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-2.0.943.tgz",
|
||||
"integrity": "sha512-iLhNcm4XceTHRaSU5o22ZGCm4YpuW5+rf4+BJFH/feBhMQLbCGBry+Jet8Q419QDI4qgARaIQzXuiNrsNWS8Yw==",
|
||||
"version": "2.2.228",
|
||||
"resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-2.2.228.tgz",
|
||||
"integrity": "sha512-W5LhYPMS2UKX0ELIa4u+CFCMoox5qQNQElt0bAK2mwz1V8jZL0rvLao+0tBujce84PK6PvWG36Nwr7agCCWFGQ==",
|
||||
"requires": {
|
||||
"node-ensure": "^0.0.0",
|
||||
"worker-loader": "^2.0.0"
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
"passport-orcid": "0.0.3",
|
||||
"passport-saml": "^1.1.0",
|
||||
"passport-twitter": "^1.0.4",
|
||||
"pdfjs-dist": "^2.0.943",
|
||||
"pdfjs-dist": "^2.2.228",
|
||||
"pug": "^2.0.0-beta6",
|
||||
"react": "^15.4.2",
|
||||
"react-dom": "^15.4.2",
|
||||
|
|
Loading…
Reference in a new issue