Skip to content
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
13 changes: 11 additions & 2 deletions css/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@

/* Replace default "Download" icon in "Download / Save" button with a "Save"
* icon. */
.toolbarButton#download::before {
.toolbarButton#download::before,
.secondaryToolbarButton#secondaryDownload::before {
-webkit-mask-image: url(../img/toolbarButton-secondaryToolbarSave.svg);
mask-image: url(../img/toolbarButton-secondaryToolbarSave.svg);
}
Expand All @@ -38,7 +39,8 @@

/* Hide the normal toolbar icon, which is a mask applied on a dark background,
* when showing the loading icon. */
.toolbarButton.icon-loading-small:before {
.toolbarButton.icon-loading-small:before,
.secondaryToolbarButton.icon-loading-small:before {
background-color: unset;
}

Expand Down Expand Up @@ -68,6 +70,13 @@
border-top-color: var(--color-loading-dark);
}

/* Place the loading icon on the secondary toolbar icon by using the same
* inset-inline-start of the secondary toolbar icon (12px) and correcting the
* margin from the loading icon (8px). */
.secondaryToolbarButton.icon-loading-small:after {
inset-inline-start: 20px;
}

@keyframes rotate {
from {
transform: rotate(0deg);
Expand Down
4 changes: 2 additions & 2 deletions js/files_pdfviewer-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/files_pdfviewer-main.js.map

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions src/views/PDFView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export default {
if (this.isEditable) {
this.$nextTick(() => {
this.getDownloadElement().removeAttribute('hidden')
this.getSecondaryDownloadElement().removeAttribute('hidden')
})
}
},
Expand All @@ -125,6 +126,10 @@ export default {
return this.getIframeDocument().getElementById('download')
},

getSecondaryDownloadElement() {
return this.getIframeDocument().getElementById('secondaryDownload')
},

getViewerTemplateParameter(parameterName) {
// templates/viewer.php provides the PDF viewer parameters in the
// data attributes of the head element.
Expand Down Expand Up @@ -196,6 +201,7 @@ export default {
onSetModifiedOriginal(...args)

this.getDownloadElement().removeAttribute('disabled')
this.getSecondaryDownloadElement().removeAttribute('disabled')
}
})

Expand Down Expand Up @@ -262,6 +268,10 @@ export default {
downloadElement.setAttribute('disabled', 'disabled')
downloadElement.classList.add('icon-loading-small')

const secondaryDownloadElement = this.getSecondaryDownloadElement()
secondaryDownloadElement.setAttribute('disabled', 'disabled')
secondaryDownloadElement.classList.add('icon-loading-small')

logger.info('PDF Document with annotation is being saved')

this.PDFViewerApplication.pdfDocument.saveDocument().then((data) => {
Expand All @@ -277,8 +287,10 @@ export default {
// successful it will be enabled again when a new annotation is
// added.
downloadElement.removeAttribute('disabled')
secondaryDownloadElement.removeAttribute('disabled')
}).finally(() => {
downloadElement.classList.remove('icon-loading-small')
secondaryDownloadElement.classList.remove('icon-loading-small')
})
},
},
Expand Down
2 changes: 1 addition & 1 deletion templates/viewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
<span data-l10n-id="pdfjs-print-button-label">Print</span>
</button>

<button id="secondaryDownload" class="secondaryToolbarButton visibleMediumView" title="Save" tabindex="53" data-l10n-id="pdfjs-save-button" hidden="true">
<button id="secondaryDownload" class="secondaryToolbarButton visibleMediumView" disabled="disabled" title="Save" tabindex="53" data-l10n-id="pdfjs-save-button" hidden="true">
<span data-l10n-id="pdfjs-save-button-label">Save</span>
</button>

Expand Down
Loading