Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display a wait cursor when saving #18243

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1133,12 +1133,19 @@ const PDFViewerApplication = {
}
},

downloadOrSave(options = {}) {
if (this.pdfDocument?.annotationStorage.size > 0) {
this.save(options);
} else {
this.download(options);
}
async downloadOrSave(options = {}) {
// In the Firefox case, this method MUST always trigger a download.
// When the user is closing a modified and unsaved document, we display a
// prompt asking for saving or not. In case they save, we must wait for
// saving to complete before closing the tab.
// So in case this function does not trigger a download, we must trigger a
// a message and change PdfjsChild.sys.mjs to take it into account.
const { classList } = this.appConfig.appContainer;
classList.add("wait");
await (this.pdfDocument?.annotationStorage.size > 0
? this.save(options)
: this.download(options));
classList.remove("wait");
},

/**
Expand Down
9 changes: 9 additions & 0 deletions web/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,15 @@ body {
body {
background-color: var(--body-bg-color);
scrollbar-color: var(--scrollbar-color) var(--scrollbar-bg-color);

&.wait::before {
content: "";
position: fixed;
width: 100%;
height: 100%;
z-index: 100000;
cursor: wait;
}
}

.hidden,
Expand Down