mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 17:48:07 +02:00
Implement the setDocument
method for the find controller
Now it follows the same pattern as e.g., the document properties component, which allows us to have one instance of the find controller and set a new document to search upon switching documents. Moreover, this allows us to get rid of the dependency on `pdfViewer` in order to fetch the text content for a page. This is working towards getting rid of the `pdfViewer` dependency upon initializing the component entirely in future commits. Finally, we make the `reset` method private since it's not supposed to be used from the outside anymore now that `setDocument` takes care of this, similar to other components.
This commit is contained in:
parent
b14c1fbc28
commit
e293c12afc
7 changed files with 59 additions and 38 deletions
|
@ -55,7 +55,7 @@ container.addEventListener('pagesinit', function () {
|
|||
pdfViewer.currentScaleValue = 'page-width';
|
||||
|
||||
if (SEARCH_FOR) { // We can try search for things
|
||||
pdfFindController.executeCommand('find', {query: SEARCH_FOR});
|
||||
pdfFindController.executeCommand('find', { query: SEARCH_FOR, });
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -70,4 +70,5 @@ pdfjsLib.getDocument({
|
|||
pdfViewer.setDocument(pdfDocument);
|
||||
|
||||
pdfLinkService.setDocument(pdfDocument, null);
|
||||
pdfFindController.setDocument(pdfDocument);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue