mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Merge pull request #5007 from timvandermeij/pdfview-tlb
Converting PDFFindBar and PDFFindController to classes
This commit is contained in:
commit
df8d2573dd
5 changed files with 442 additions and 440 deletions
|
@ -14,13 +14,13 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* globals PDFJS, PDFBug, FirefoxCom, Stats, Cache, PDFFindBar, CustomStyle,
|
||||
PDFFindController, ProgressBar, TextLayerBuilder, DownloadManager,
|
||||
getFileName, scrollIntoView, getPDFFileNameFromURL, PDFHistory,
|
||||
Preferences, SidebarView, ViewHistory, PageView, ThumbnailView, URL,
|
||||
noContextMenuHandler, SecondaryToolbar, PasswordPrompt,
|
||||
PresentationMode, HandTool, Promise, DocumentProperties,
|
||||
DocumentOutlineView, DocumentAttachmentsView, OverlayManager */
|
||||
/* globals PDFJS, PDFBug, FirefoxCom, Stats, Cache, CustomStyle, ProgressBar,
|
||||
DownloadManager, getFileName, scrollIntoView, getPDFFileNameFromURL,
|
||||
PDFHistory, Preferences, SidebarView, ViewHistory, PageView,
|
||||
ThumbnailView, URL, noContextMenuHandler, SecondaryToolbar,
|
||||
PasswordPrompt, PresentationMode, HandTool, Promise,
|
||||
DocumentProperties, DocumentOutlineView, DocumentAttachmentsView,
|
||||
OverlayManager, PDFFindController, PDFFindBar */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -145,7 +145,12 @@ var PDFView = {
|
|||
|
||||
Preferences.initialize();
|
||||
|
||||
PDFFindBar.initialize({
|
||||
this.findController = new PDFFindController({
|
||||
pdfPageSource: this,
|
||||
integratedFind: this.supportsIntegratedFind
|
||||
});
|
||||
|
||||
this.findBar = new PDFFindBar({
|
||||
bar: document.getElementById('findbar'),
|
||||
toggleButton: document.getElementById('viewFind'),
|
||||
findField: document.getElementById('findInput'),
|
||||
|
@ -154,13 +159,11 @@ var PDFView = {
|
|||
findMsg: document.getElementById('findMsg'),
|
||||
findStatusIcon: document.getElementById('findStatusIcon'),
|
||||
findPreviousButton: document.getElementById('findPrevious'),
|
||||
findNextButton: document.getElementById('findNext')
|
||||
findNextButton: document.getElementById('findNext'),
|
||||
findController: this.findController
|
||||
});
|
||||
|
||||
PDFFindController.initialize({
|
||||
pdfPageSource: this,
|
||||
integratedFind: this.supportsIntegratedFind
|
||||
});
|
||||
this.findController.setFindBar(this.findBar);
|
||||
|
||||
HandTool.initialize({
|
||||
container: container,
|
||||
|
@ -939,7 +942,7 @@ var PDFView = {
|
|||
};
|
||||
}
|
||||
|
||||
PDFFindController.reset();
|
||||
PDFView.findController.reset();
|
||||
|
||||
this.pdfDocument = pdfDocument;
|
||||
|
||||
|
@ -1028,7 +1031,7 @@ var PDFView = {
|
|||
|
||||
PDFView.loadingBar.setWidth(container);
|
||||
|
||||
PDFFindController.resolveFirstPage();
|
||||
PDFView.findController.resolveFirstPage();
|
||||
|
||||
// Initialize the browsing history.
|
||||
PDFHistory.initialize(self.documentFingerprint);
|
||||
|
@ -2237,13 +2240,13 @@ window.addEventListener('keydown', function keydown(evt) {
|
|||
switch (evt.keyCode) {
|
||||
case 70: // f
|
||||
if (!PDFView.supportsIntegratedFind) {
|
||||
PDFFindBar.open();
|
||||
PDFView.findBar.open();
|
||||
handled = true;
|
||||
}
|
||||
break;
|
||||
case 71: // g
|
||||
if (!PDFView.supportsIntegratedFind) {
|
||||
PDFFindBar.dispatchEvent('again', cmd === 5 || cmd === 12);
|
||||
PDFView.findBar.dispatchEvent('again', cmd === 5 || cmd === 12);
|
||||
handled = true;
|
||||
}
|
||||
break;
|
||||
|
@ -2344,8 +2347,8 @@ window.addEventListener('keydown', function keydown(evt) {
|
|||
SecondaryToolbar.close();
|
||||
handled = true;
|
||||
}
|
||||
if (!PDFView.supportsIntegratedFind && PDFFindBar.opened) {
|
||||
PDFFindBar.close();
|
||||
if (!PDFView.supportsIntegratedFind && PDFView.findBar.opened) {
|
||||
PDFView.findBar.close();
|
||||
handled = true;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue