From 8131440f9eb314a75cbec05fc547903c1f3fd29c Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Wed, 11 Feb 2015 13:05:04 +0100 Subject: [PATCH] Move the call to |PDFFindController.resolveFirstPage| into PDFViewer From reading IRC scrollback, it became clear that having to manually call `PDFFindController.resolveFirstPage` in order for the find functionality to work isn't particulary good. Hence this PR, which moves that code into `PDFViewer.setDocument` to make life easier for third-party implementations. --- web/pdf_viewer.js | 4 ++++ web/viewer.js | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/web/pdf_viewer.js b/web/pdf_viewer.js index 6e2acd33b544d..dd3873b46aa10 100644 --- a/web/pdf_viewer.js +++ b/web/pdf_viewer.js @@ -306,6 +306,10 @@ var PDFViewer = (function pdfViewer() { if (this.defaultRenderingQueue) { this.update(); } + + if (this.findController) { + this.findController.resolveFirstPage(); + } }.bind(this)); }, diff --git a/web/viewer.js b/web/viewer.js index d8b62d1ba1f0d..bb0ab166abe03 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -863,8 +863,6 @@ var PDFViewerApplication = { self.loadingBar.setWidth(document.getElementById('viewer')); - self.findController.resolveFirstPage(); - if (!PDFJS.disableHistory && !self.isViewerEmbedded) { // The browsing history is only enabled when the viewer is standalone, // i.e. not when it is embedded in a web page.