Add a enhanceTextSelection preference
				
					
				
			Please note that this is a hack, but I think that it should be OK for now to atleast get the preference landed. Refer to the code comment for further information. Re: issue 7584 and PR 7586.
This commit is contained in:
		
							parent
							
								
									ca61ccc533
								
							
						
					
					
						commit
						e12c48b73f
					
				| @ -95,6 +95,10 @@ | |||||||
|       "description": "Whether to prevent the extension from reporting the extension and browser version to the extension developers.", |       "description": "Whether to prevent the extension from reporting the extension and browser version to the extension developers.", | ||||||
|       "default": false |       "default": false | ||||||
|     }, |     }, | ||||||
|  |     "enhanceTextSelection": { | ||||||
|  |       "type": "boolean", | ||||||
|  |       "default": false | ||||||
|  |     }, | ||||||
|     "renderInteractiveForms": { |     "renderInteractiveForms": { | ||||||
|       "type": "boolean", |       "type": "boolean", | ||||||
|       "default": false |       "default": false | ||||||
|  | |||||||
							
								
								
									
										15
									
								
								web/app.js
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								web/app.js
									
									
									
									
									
								
							| @ -101,7 +101,6 @@ var SCALE_SELECT_CONTAINER_PADDING = 8; | |||||||
| var SCALE_SELECT_PADDING = 22; | var SCALE_SELECT_PADDING = 22; | ||||||
| var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading'; | var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading'; | ||||||
| var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000; | var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000; | ||||||
| var ENHANCE_TEXT_SELECTION = false; |  | ||||||
| 
 | 
 | ||||||
| function configure(PDFJS) { | function configure(PDFJS) { | ||||||
|   PDFJS.imageResourcesPath = './images/'; |   PDFJS.imageResourcesPath = './images/'; | ||||||
| @ -211,7 +210,7 @@ var PDFViewerApplication = { | |||||||
|       renderingQueue: pdfRenderingQueue, |       renderingQueue: pdfRenderingQueue, | ||||||
|       linkService: pdfLinkService, |       linkService: pdfLinkService, | ||||||
|       downloadManager: downloadManager, |       downloadManager: downloadManager, | ||||||
|       enhanceTextSelection: ENHANCE_TEXT_SELECTION, |       enhanceTextSelection: false, | ||||||
|     }); |     }); | ||||||
|     pdfRenderingQueue.setViewer(this.pdfViewer); |     pdfRenderingQueue.setViewer(this.pdfViewer); | ||||||
|     pdfLinkService.setViewer(this.pdfViewer); |     pdfLinkService.setViewer(this.pdfViewer); | ||||||
| @ -323,6 +322,18 @@ var PDFViewerApplication = { | |||||||
|       Preferences.get('defaultZoomValue').then(function resolved(value) { |       Preferences.get('defaultZoomValue').then(function resolved(value) { | ||||||
|         self.preferenceDefaultZoomValue = value; |         self.preferenceDefaultZoomValue = value; | ||||||
|       }), |       }), | ||||||
|  |       Preferences.get('enhanceTextSelection').then(function resolved(value) { | ||||||
|  |         // TODO: Move the initialization and fetching of `Preferences` to occur
 | ||||||
|  |         //       before the various viewer components are initialized.
 | ||||||
|  |         //
 | ||||||
|  |         // This was attempted in: https://github.com/mozilla/pdf.js/pull/7586,
 | ||||||
|  |         // but it had to be backed out since it violated implicit assumptions
 | ||||||
|  |         // about some viewer components being synchronously available.
 | ||||||
|  |         //
 | ||||||
|  |         // NOTE: This hack works since the `enhanceTextSelection` option is not
 | ||||||
|  |         //       needed until `PDFViewer.setDocument` has been called.
 | ||||||
|  |         self.pdfViewer.enhanceTextSelection = value; | ||||||
|  |       }), | ||||||
|       Preferences.get('disableTextLayer').then(function resolved(value) { |       Preferences.get('disableTextLayer').then(function resolved(value) { | ||||||
|         if (PDFJS.disableTextLayer === true) { |         if (PDFJS.disableTextLayer === true) { | ||||||
|           return; |           return; | ||||||
|  | |||||||
| @ -12,5 +12,6 @@ | |||||||
|   "disableTextLayer": false, |   "disableTextLayer": false, | ||||||
|   "useOnlyCssZoom": false, |   "useOnlyCssZoom": false, | ||||||
|   "externalLinkTarget": 0, |   "externalLinkTarget": 0, | ||||||
|  |   "enhanceTextSelection": false, | ||||||
|   "renderInteractiveForms": false |   "renderInteractiveForms": false | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user