-
Notifications
You must be signed in to change notification settings - Fork 44
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
danxuliu
merged 1 commit into
master
from
fix-disabled-annotation-edition-in-view-only-files
Jan 30, 2025
Merged
Fix disabled annotation edition in view only files #1108
danxuliu
merged 1 commit into
master
from
fix-disabled-annotation-edition-in-view-only-files
Jan 30, 2025
Conversation
This file contains 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
1537d03
to
640758c
Compare
/compile amend / |
640758c
to
6a3d1fa
Compare
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 <[email protected]>
57842d7
to
5b966a6
Compare
/backport to stable31 |
/backport to stable30 |
/backport to stable29 |
szaimen
approved these changes
Jan 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works :)
This was referenced Jan 30, 2025
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
annotationEditorMode
of PDF.js set toAnnotationEditorType.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.
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