Call the reset() methods in the PDFAttachmentViewer and PDFOutlineViewer constructors
				
					
				
			Rather than duplicating initialization code, we can just call `this.reset()` instead (which is also similar to other existing code, e.g. `PDFViewer`). This will also help ensure that the DOM is completely reset, before any outline items or attachments are displayed.
This commit is contained in:
		
							parent
							
								
									3a017b4317
								
							
						
					
					
						commit
						96fb0c0370
					
				@ -35,13 +35,12 @@ class PDFAttachmentViewer {
 | 
				
			|||||||
   * @param {PDFAttachmentViewerOptions} options
 | 
					   * @param {PDFAttachmentViewerOptions} options
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  constructor({ container, eventBus, downloadManager, }) {
 | 
					  constructor({ container, eventBus, downloadManager, }) {
 | 
				
			||||||
    this.attachments = null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.container = container;
 | 
					    this.container = container;
 | 
				
			||||||
    this.eventBus = eventBus;
 | 
					    this.eventBus = eventBus;
 | 
				
			||||||
    this.downloadManager = downloadManager;
 | 
					    this.downloadManager = downloadManager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this._renderedCapability = createPromiseCapability();
 | 
					    this.reset();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.eventBus.on('fileattachmentannotation',
 | 
					    this.eventBus.on('fileattachmentannotation',
 | 
				
			||||||
      this._appendAttachment.bind(this));
 | 
					      this._appendAttachment.bind(this));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
@ -36,12 +36,11 @@ class PDFOutlineViewer {
 | 
				
			|||||||
   * @param {PDFOutlineViewerOptions} options
 | 
					   * @param {PDFOutlineViewerOptions} options
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  constructor({ container, linkService, eventBus, }) {
 | 
					  constructor({ container, linkService, eventBus, }) {
 | 
				
			||||||
    this.outline = null;
 | 
					 | 
				
			||||||
    this.lastToggleIsShow = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.container = container;
 | 
					    this.container = container;
 | 
				
			||||||
    this.linkService = linkService;
 | 
					    this.linkService = linkService;
 | 
				
			||||||
    this.eventBus = eventBus;
 | 
					    this.eventBus = eventBus;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    this.reset();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  reset() {
 | 
					  reset() {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user