Skip to content

Commit 95edaa5

Browse files
authored
Merge pull request #1337 from nextcloud/backport/1334/stable31
[stable31] fix: Show save button in secondary toolbar for editable files
2 parents 21125af + 265dcbf commit 95edaa5

5 files changed

Lines changed: 27 additions & 6 deletions

File tree

css/viewer.css

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626

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

3940
/* Hide the normal toolbar icon, which is a mask applied on a dark background,
4041
* when showing the loading icon. */
41-
.toolbarButton.icon-loading-small:before {
42+
.toolbarButton.icon-loading-small:before,
43+
.secondaryToolbarButton.icon-loading-small:before {
4244
background-color: unset;
4345
}
4446

@@ -68,6 +70,13 @@
6870
border-top-color: var(--color-loading-dark);
6971
}
7072

73+
/* Place the loading icon on the secondary toolbar icon by using the same
74+
* inset-inline-start of the secondary toolbar icon (12px) and correcting the
75+
* margin from the loading icon (8px). */
76+
.secondaryToolbarButton.icon-loading-small:after {
77+
inset-inline-start: 20px;
78+
}
79+
7180
@keyframes rotate {
7281
from {
7382
transform: rotate(0deg);

js/files_pdfviewer-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/files_pdfviewer-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/views/PDFView.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export default {
110110
if (this.isEditable) {
111111
this.$nextTick(() => {
112112
this.getDownloadElement().removeAttribute('hidden')
113+
this.getSecondaryDownloadElement().removeAttribute('hidden')
113114
})
114115
}
115116
},
@@ -124,6 +125,10 @@ export default {
124125
return this.getIframeDocument().getElementById('download')
125126
},
126127
128+
getSecondaryDownloadElement() {
129+
return this.getIframeDocument().getElementById('secondaryDownload')
130+
},
131+
127132
getViewerTemplateParameter(parameterName) {
128133
// templates/viewer.php provides the PDF viewer parameters in the
129134
// data attributes of the head element.
@@ -195,6 +200,7 @@ export default {
195200
onSetModifiedOriginal.apply(null, arguments)
196201
197202
this.getDownloadElement().removeAttribute('disabled')
203+
this.getSecondaryDownloadElement().removeAttribute('disabled')
198204
}
199205
})
200206
@@ -261,6 +267,10 @@ export default {
261267
downloadElement.setAttribute('disabled', 'disabled')
262268
downloadElement.classList.add('icon-loading-small')
263269
270+
const secondaryDownloadElement = this.getSecondaryDownloadElement()
271+
secondaryDownloadElement.setAttribute('disabled', 'disabled')
272+
secondaryDownloadElement.classList.add('icon-loading-small')
273+
264274
logger.info('PDF Document with annotation is being saved')
265275
266276
this.PDFViewerApplication.pdfDocument.saveDocument().then((data) => {
@@ -276,8 +286,10 @@ export default {
276286
// successful it will be enabled again when a new annotation is
277287
// added.
278288
downloadElement.removeAttribute('disabled')
289+
secondaryDownloadElement.removeAttribute('disabled')
279290
}).finally(() => {
280291
downloadElement.classList.remove('icon-loading-small')
292+
secondaryDownloadElement.classList.remove('icon-loading-small')
281293
})
282294
},
283295
},

templates/viewer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@
190190
<span data-l10n-id="pdfjs-print-button-label">Print</span>
191191
</button>
192192

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

0 commit comments

Comments
 (0)