@@ -37,6 +37,7 @@ class Reader {
37
37
this . _platform = options . platform ;
38
38
this . _data = options . data ;
39
39
this . _password = options . password ;
40
+ this . _preview = options . preview ;
40
41
41
42
this . _readerContext = { type : this . _type , platform : this . _platform } ;
42
43
@@ -224,64 +225,81 @@ class Reader {
224
225
225
226
this . _primaryView = this . _createView ( true , options . location ) ;
226
227
227
- ReactDOM . render (
228
- < IntlProvider
229
- locale = { window . navigator . language }
230
- messages = { this . _localizedStrings }
231
- onError = { window . development && ( ( ) => {
232
- } ) }
233
- >
234
- < ReaderContext . Provider value = { this . _readerContext } >
235
- < ReaderUI
236
- type = { this . _type }
237
- state = { this . _state }
238
- onSelectAnnotations = { this . setSelectedAnnotations . bind ( this ) }
239
- onZoomIn = { this . zoomIn . bind ( this ) }
240
- onZoomOut = { this . zoomOut . bind ( this ) }
241
- onZoomReset = { this . zoomReset . bind ( this ) }
242
- onNavigateBack = { this . navigateBack . bind ( this ) }
243
- onNavigateToPreviousPage = { this . navigateToPreviousPage . bind ( this ) }
244
- onNavigateToNextPage = { this . navigateToNextPage . bind ( this ) }
245
- onChangePageNumber = { pageNumber => this . navigate ( { pageNumber } ) }
246
- onChangeTool = { this . setTool . bind ( this ) }
247
- onToggleFind = { this . toggleFindPopup . bind ( this ) }
248
- onChangeFilter = { this . setFilter . bind ( this ) }
249
- onChangeSidebarView = { this . setSidebarView . bind ( this ) }
250
- onToggleSidebar = { ( open ) => { this . toggleSidebar ( open ) ; this . _onToggleSidebar ( open ) ; } }
251
- onResizeSidebar = { ( width ) => { this . setSidebarWidth ( width ) ; this . _onChangeSidebarWidth ( width ) ; } }
252
- onResizeSplitView = { this . setSplitViewSize . bind ( this ) }
253
- onAddAnnotation = { ( annotation ) => { this . _annotationManager . addAnnotation ( annotation ) ; this . setSelectedAnnotations ( [ ] ) ; } }
254
- onUpdateAnnotations = { ( annotations ) => { this . _annotationManager . updateAnnotations ( annotations ) ; this . _enableAnnotationDeletionFromComment = false ; } }
255
- onDeleteAnnotations = { this . _annotationManager . deleteAnnotations . bind ( this . _annotationManager ) }
256
- onOpenTagsPopup = { this . _onOpenTagsPopup }
257
- onOpenPageLabelPopup = { this . _handleOpenPageLabelPopup . bind ( this ) }
258
- onOpenColorContextMenu = { params => this . _onOpenContextMenu ( createColorContextMenu ( this , params ) ) }
259
- onOpenAnnotationContextMenu = { params => this . _onOpenContextMenu ( createAnnotationContextMenu ( this , params ) ) }
260
- onOpenSelectorContextMenu = { params => this . _onOpenContextMenu ( createSelectorContextMenu ( this , params ) ) }
261
- onOpenThumbnailContextMenu = { params => this . _onOpenContextMenu ( createThumbnailContextMenu ( this , params ) ) }
262
- onCloseContextMenu = { this . closeContextMenu . bind ( this ) }
263
- onCloseLabelPopup = { this . _handleLabelPopupClose . bind ( this ) }
264
- onEnterPassword = { this . enterPassword . bind ( this ) }
265
- onAddToNote = { ( annotations ) => { this . _onAddToNote ( annotations ) ; this . setSelectedAnnotations ( [ ] ) ; } }
266
- onNavigate = { this . navigate . bind ( this ) }
267
- onUpdateOutline = { outline => this . _updateState ( { outline } ) }
268
- onRenderThumbnails = { ( pageIndexes ) => this . _primaryView . _pdfThumbnails . render ( pageIndexes ) }
269
- onSetDataTransferAnnotations = { this . _handleSetDataTransferAnnotations . bind ( this ) }
270
- onOpenLink = { this . _onOpenLink }
271
- onChangeFindState = { this . _handleFindStateChange . bind ( this ) }
272
- onFindNext = { this . findNext . bind ( this ) }
273
- onFindPrevious = { this . findPrevious . bind ( this ) }
274
- onToggleFindPopup = { this . toggleFindPopup . bind ( this ) }
275
- onToggleContextPane = { this . _onToggleContextPane }
276
- ref = { this . _readerRef }
277
- />
278
- </ ReaderContext . Provider >
279
- </ IntlProvider > ,
280
- document . getElementById ( 'reader-ui' ) ,
281
- ( ) => {
282
- this . _resolveUIInitializedPromise ( ) ;
283
- }
284
- ) ;
228
+ if ( ! this . _preview ) {
229
+ ReactDOM . render (
230
+ < IntlProvider
231
+ locale = { window . navigator . language }
232
+ messages = { this . _localizedStrings }
233
+ onError = { window . development && ( ( ) => {
234
+ } ) }
235
+ >
236
+ < ReaderContext . Provider value = { this . _readerContext } >
237
+ < ReaderUI
238
+ type = { this . _type }
239
+ state = { this . _state }
240
+ onSelectAnnotations = { this . setSelectedAnnotations . bind ( this ) }
241
+ onZoomIn = { this . zoomIn . bind ( this ) }
242
+ onZoomOut = { this . zoomOut . bind ( this ) }
243
+ onZoomReset = { this . zoomReset . bind ( this ) }
244
+ onNavigateBack = { this . navigateBack . bind ( this ) }
245
+ onNavigateToPreviousPage = { this . navigateToPreviousPage . bind ( this ) }
246
+ onNavigateToNextPage = { this . navigateToNextPage . bind ( this ) }
247
+ onChangePageNumber = { pageNumber => this . navigate ( { pageNumber } ) }
248
+ onChangeTool = { this . setTool . bind ( this ) }
249
+ onToggleFind = { this . toggleFindPopup . bind ( this ) }
250
+ onChangeFilter = { this . setFilter . bind ( this ) }
251
+ onChangeSidebarView = { this . setSidebarView . bind ( this ) }
252
+ onToggleSidebar = { ( open ) => {
253
+ this . toggleSidebar ( open ) ;
254
+ this . _onToggleSidebar ( open ) ;
255
+ } }
256
+ onResizeSidebar = { ( width ) => {
257
+ this . setSidebarWidth ( width ) ;
258
+ this . _onChangeSidebarWidth ( width ) ;
259
+ } }
260
+ onResizeSplitView = { this . setSplitViewSize . bind ( this ) }
261
+ onAddAnnotation = { ( annotation ) => {
262
+ this . _annotationManager . addAnnotation ( annotation ) ;
263
+ this . setSelectedAnnotations ( [ ] ) ;
264
+ } }
265
+ onUpdateAnnotations = { ( annotations ) => {
266
+ this . _annotationManager . updateAnnotations ( annotations ) ;
267
+ this . _enableAnnotationDeletionFromComment = false ;
268
+ } }
269
+ onDeleteAnnotations = { this . _annotationManager . deleteAnnotations . bind ( this . _annotationManager ) }
270
+ onOpenTagsPopup = { this . _onOpenTagsPopup }
271
+ onOpenPageLabelPopup = { this . _handleOpenPageLabelPopup . bind ( this ) }
272
+ onOpenColorContextMenu = { params => this . _onOpenContextMenu ( createColorContextMenu ( this , params ) ) }
273
+ onOpenAnnotationContextMenu = { params => this . _onOpenContextMenu ( createAnnotationContextMenu ( this , params ) ) }
274
+ onOpenSelectorContextMenu = { params => this . _onOpenContextMenu ( createSelectorContextMenu ( this , params ) ) }
275
+ onOpenThumbnailContextMenu = { params => this . _onOpenContextMenu ( createThumbnailContextMenu ( this , params ) ) }
276
+ onCloseContextMenu = { this . closeContextMenu . bind ( this ) }
277
+ onCloseLabelPopup = { this . _handleLabelPopupClose . bind ( this ) }
278
+ onEnterPassword = { this . enterPassword . bind ( this ) }
279
+ onAddToNote = { ( annotations ) => {
280
+ this . _onAddToNote ( annotations ) ;
281
+ this . setSelectedAnnotations ( [ ] ) ;
282
+ } }
283
+ onNavigate = { this . navigate . bind ( this ) }
284
+ onUpdateOutline = { outline => this . _updateState ( { outline } ) }
285
+ onRenderThumbnails = { ( pageIndexes ) => this . _primaryView . _pdfThumbnails . render ( pageIndexes ) }
286
+ onSetDataTransferAnnotations = { this . _handleSetDataTransferAnnotations . bind ( this ) }
287
+ onOpenLink = { this . _onOpenLink }
288
+ onChangeFindState = { this . _handleFindStateChange . bind ( this ) }
289
+ onFindNext = { this . findNext . bind ( this ) }
290
+ onFindPrevious = { this . findPrevious . bind ( this ) }
291
+ onToggleFindPopup = { this . toggleFindPopup . bind ( this ) }
292
+ onToggleContextPane = { this . _onToggleContextPane }
293
+ ref = { this . _readerRef }
294
+ />
295
+ </ ReaderContext . Provider >
296
+ </ IntlProvider > ,
297
+ document . getElementById ( 'reader-ui' ) ,
298
+ ( ) => {
299
+ this . _resolveUIInitializedPromise ( ) ;
300
+ }
301
+ ) ;
302
+ }
285
303
286
304
this . _updateState ( this . _state , true ) ;
287
305
@@ -789,6 +807,7 @@ class Reader {
789
807
data,
790
808
platform : this . _platform ,
791
809
readOnly : this . _state . readOnly ,
810
+ preview : this . _preview ,
792
811
tool : this . _state . tool ,
793
812
selectedAnnotationIDs : this . _state . selectedAnnotationIDs ,
794
813
annotations : this . _state . annotations . filter ( x => ! x . _hidden ) ,
0 commit comments