Skip to content

Commit f49d835

Browse files
authored
Merge pull request #1122 from nextcloud/backport/1108/stable29
[stable29] Fix disabled annotation edition in view only files
2 parents 1600465 + 68fa675 commit f49d835

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

js/files_pdfviewer-main.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/files_pdfviewer-main.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/views/PDFView.vue

+4-5
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ export default {
115115
if (this.isEditable) {
116116
this.$nextTick(() => {
117117
this.getDownloadElement().removeAttribute('hidden')
118-
this.getEditorModeButtonsElement().removeAttribute('hidden')
119118
})
120119
}
121120
},
@@ -130,10 +129,6 @@ export default {
130129
return this.getIframeDocument().getElementById('download')
131130
},
132131

133-
getEditorModeButtonsElement() {
134-
return this.getIframeDocument().getElementById('editorModeButtons')
135-
},
136-
137132
handleWebviewerloaded() {
138133
const PDFViewerApplicationOptions = this.$refs.iframe.contentWindow.PDFViewerApplicationOptions
139134

@@ -162,6 +157,10 @@ export default {
162157
// AnnotationMode.ENABLE value is 1 in PDF.js, which shows
163158
// forms, but does not allow to interact with them
164159
PDFViewerApplicationOptions.set('annotationMode', 1)
160+
161+
// AnnotationEditorType.DISABLE value is -1 in PDF.js, which
162+
// prevents editing annotations
163+
PDFViewerApplicationOptions.set('annotationEditorMode', -1)
165164
}
166165

167166
// PDFViewerApplication can not be set when the "webviewerloaded"

templates/viewer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@
303303

304304
<div class="verticalToolbarSeparator hiddenMediumView"></div>
305305

306-
<div id="editorModeButtons" class="splitToolbarButton toggled" role="radiogroup" hidden="true">
306+
<div id="editorModeButtons" class="splitToolbarButton toggled" role="radiogroup">
307307
<button id="editorFreeText" class="toolbarButton" disabled="disabled" title="Text" role="radio" aria-checked="false" aria-controls="editorFreeTextParamsToolbar" tabindex="34" data-l10n-id="editor_free_text2">
308308
<span data-l10n-id="editor_free_text2_label">Text</span>
309309
</button>
@@ -315,7 +315,7 @@
315315
</button>
316316
</div>
317317

318-
<div id="editorModeSeparator" class="verticalToolbarSeparator" hidden="true"></div>
318+
<div id="editorModeSeparator" class="verticalToolbarSeparator"></div>
319319

320320
<button id="secondaryToolbarToggle" class="toolbarButton" title="Tools" tabindex="48" data-l10n-id="tools" aria-expanded="false" aria-controls="secondaryToolbar">
321321
<span data-l10n-id="tools_label">Tools</span>

0 commit comments

Comments
 (0)