Skip to content

Commit 8199f26

Browse files
authored
Merge pull request #1123 from nextcloud/backport/1108/stable30
[stable30] Fix disabled annotation edition in view only files
2 parents 5a39d42 + dc34111 commit 8199f26

4 files changed

Lines changed: 9 additions & 10 deletions

File tree

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: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ export default {
9797
if (this.isEditable) {
9898
this.$nextTick(() => {
9999
this.getDownloadElement().removeAttribute('hidden')
100-
this.getEditorModeButtonsElement().removeAttribute('hidden')
101100
})
102101
}
103102
},
@@ -112,10 +111,6 @@ export default {
112111
return this.getIframeDocument().getElementById('download')
113112
},
114113
115-
getEditorModeButtonsElement() {
116-
return this.getIframeDocument().getElementById('editorModeButtons')
117-
},
118-
119114
handleWebviewerloaded() {
120115
const PDFViewerApplicationOptions = this.$refs.iframe.contentWindow.PDFViewerApplicationOptions
121116
@@ -144,6 +139,10 @@ export default {
144139
// AnnotationMode.ENABLE value is 1 in PDF.js, which shows
145140
// forms, but does not allow to interact with them
146141
PDFViewerApplicationOptions.set('annotationMode', 1)
142+
143+
// AnnotationEditorType.DISABLE value is -1 in PDF.js, which
144+
// prevents editing annotations
145+
PDFViewerApplicationOptions.set('annotationEditorMode', -1)
147146
}
148147
149148
// PDFViewerApplication can not be set when the "webviewerloaded"

templates/viewer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@
310310

311311
<div class="verticalToolbarSeparator hiddenMediumView"></div>
312312

313-
<div id="editorModeButtons" class="splitToolbarButton toggled" role="radiogroup" hidden="true">
313+
<div id="editorModeButtons" class="splitToolbarButton toggled" role="radiogroup">
314314
<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">
315315
<span data-l10n-id="editor_free_text2_label">Text</span>
316316
</button>
@@ -322,7 +322,7 @@
322322
</button>
323323
</div>
324324

325-
<div id="editorModeSeparator" class="verticalToolbarSeparator" hidden="true"></div>
325+
<div id="editorModeSeparator" class="verticalToolbarSeparator"></div>
326326

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

0 commit comments

Comments
 (0)