Fix disabled annotation edition in view only files#1108
Merged
danxuliu merged 1 commit intoJan 30, 2025
Conversation
danxuliu
force-pushed
the
fix-disabled-annotation-edition-in-view-only-files
branch
2 times, most recently
from
January 20, 2025 10:57
1537d03 to
640758c
Compare
Member
Author
|
/compile amend / |
nextcloud-command
force-pushed
the
fix-disabled-annotation-edition-in-view-only-files
branch
from
January 20, 2025 10:59
640758c to
6a3d1fa
Compare
danxuliu
force-pushed
the
fix-disabled-annotation-edition-in-view-only-files
branch
from
January 29, 2025 23:07
6a3d1fa to
57842d7
Compare
When a PDF file was shared without edit permissions the annotation editor buttons were hidden in the toolbar. Besides being a dirty trick, it only prevented creating new annotations, but not editing existing ones. Now the parameter "annotationEditorMode" of PDF.js set to "AnnotationEditorType.DISABLE" is used instead, which properly disables editing annotations and also takes care of removing the buttons from the toolbar if needed. Note that the editor mode separator is no longer hidden; it was hidden back in the day when edition was not supported yet in the PDF viewer, and once edition was added it should have been shown whenever the editor buttons were shown, but it was not the case. Now it is shown by default and hidden as needed by PDF.js itself when annotation edition is disabled. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
danxuliu
force-pushed
the
fix-disabled-annotation-edition-in-view-only-files
branch
from
January 29, 2025 23:14
57842d7 to
5b966a6
Compare
danxuliu
marked this pull request as ready for review
January 29, 2025 23:18
Member
Author
|
/backport to stable31 |
Member
Author
|
/backport to stable30 |
Member
Author
|
/backport to stable29 |
danxuliu
enabled auto-merge
January 29, 2025 23:18
This was referenced Jan 30, 2025
danxuliu
deleted the
fix-disabled-annotation-edition-in-view-only-files
branch
February 13, 2025 09:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a PDF file was shared without edit permissions the annotation editor buttons were hidden in the toolbar. Besides being a dirty trick, it only prevented creating new annotations, but not editing existing ones. Now the parameter
annotationEditorModeof PDF.js set toAnnotationEditorType.DISABLEis used instead, which properly disables editing annotations and also takes care of removing the buttons from the toolbar if needed.Note that the editor mode separator is no longer hidden; it was hidden back in the day when edition was not supported yet in the PDF viewer, and once edition was added it should have been shown whenever the editor buttons were shown, but it was not the case. Now it is shown by default and hidden as needed by PDF.js itself when annotation edition is disabled.
How to test
Result with this pull request
The text annotation does not enter in edition mode; in the browser console the error
The AnnotationEditor is not enabled.will be printedResult without this pull request
The text annotation enters in edition mode; a pop up is shown in the toolbar at the place where the text annotation button would be if it was visible