mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Improve the handling of the currentOutlineButton
enabling/disabling (PR 12777 follow-up)
It's obviously better and more correct to handle the "pagesloaded" case within `PDFOutlineViewer` *itself*, rather than essentially splitting the logic in two parts and forcing `PDFSidebar` to deal with what should've been handled internally in `PDFOutlineViewer`. This is what I *should* have done in PR 12777, but for some reason didn't figure out how to implement it well enough back then; sorry about the churn here!
This commit is contained in:
parent
05b0798824
commit
27062f72c2
2 changed files with 32 additions and 7 deletions
|
@ -425,11 +425,12 @@ class PDFSidebar {
|
|||
this.eventBus._on("outlineloaded", evt => {
|
||||
onTreeLoaded(evt.outlineCount, this.outlineButton, SidebarView.OUTLINE);
|
||||
|
||||
if (evt.enableCurrentOutlineItemButton) {
|
||||
this.pdfViewer.pagesPromise.then(() => {
|
||||
this._currentOutlineItemButton.disabled = !this.isInitialViewSet;
|
||||
});
|
||||
}
|
||||
evt.currentOutlineItemPromise.then(enabled => {
|
||||
if (!this.isInitialViewSet) {
|
||||
return;
|
||||
}
|
||||
this._currentOutlineItemButton.disabled = !enabled;
|
||||
});
|
||||
});
|
||||
|
||||
this.eventBus._on("attachmentsloaded", evt => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue