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

Fix disabled annotation edition in view only files #1108

Merged
merged 1 commit into from
Jan 30, 2025
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
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.

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

getEditorModeButtonsElement() {
return this.getIframeDocument().getElementById('editorModeButtons')
},

handleWebviewerloaded() {
const PDFViewerApplicationOptions = this.$refs.iframe.contentWindow.PDFViewerApplicationOptions

Expand Down Expand Up @@ -144,6 +139,10 @@ export default {
// AnnotationMode.ENABLE value is 1 in PDF.js, which shows
// forms, but does not allow to interact with them
PDFViewerApplicationOptions.set('annotationMode', 1)

// AnnotationEditorType.DISABLE value is -1 in PDF.js, which
// prevents editing annotations
PDFViewerApplicationOptions.set('annotationEditorMode', -1)
}

// PDFViewerApplication can not be set when the "webviewerloaded"
Expand Down
4 changes: 2 additions & 2 deletions templates/viewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@

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

<div id="editorModeButtons" class="splitToolbarButton toggled" role="radiogroup" hidden="true">
<div id="editorModeButtons" class="splitToolbarButton toggled" role="radiogroup">
<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">
<span data-l10n-id="editor_free_text2_label">Text</span>
</button>
Expand All @@ -322,7 +322,7 @@
</button>
</div>

<div id="editorModeSeparator" class="verticalToolbarSeparator" hidden="true"></div>
<div id="editorModeSeparator" class="verticalToolbarSeparator"></div>

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