Commit Graph

15888 Commits

Author SHA1 Message Date
calixteman
2e83fa8e2d
Merge pull request #15117 from calixteman/freetext_resize
[Editor] Set the freetext editor dimensions when the changing the font size
2022-06-29 16:38:15 +02:00
Jonas Jenwald
8c15f5a639
Merge pull request #15116 from Snuffleupagus/pr-15113-followup
Fix the `annotationEditorMode`-compatibility for older browsers (PR 15113 follow-up)
2022-06-29 16:25:33 +02:00
Jonas Jenwald
63f2d0bb64 Fix the annotationEditorMode-compatibility for older browsers (PR 15113 follow-up) 2022-06-29 16:16:48 +02:00
Calixte Denizet
bc5b6cd08c [Editor] Set the freetext editor dimensions when the changing the font size 2022-06-29 16:11:11 +02:00
calixteman
ce63663282
Merge pull request #15111 from calixteman/1776914
Add a visible page border in HCM (bug 1776914)
2022-06-29 14:43:56 +02:00
Jonas Jenwald
e08b079691
Merge pull request #15113 from Snuffleupagus/annotationEditorMode-pref
[editor] Introduce a proper `annotationEditorMode` option/preference (PR 15075 follow-up)
2022-06-29 13:39:55 +02:00
Calixte Denizet
3e751679ba Add a visible page border in HCM (bug 1776914) 2022-06-29 11:52:19 +02:00
Jonas Jenwald
44a75c2a0f [editor] Slightly shorten the en-US freetext_default_content placeholder text
Now that it's possible to change the font-size, this placeholder string feels a little bit long (especially for larger font-sizes).

Given that Editing is not enabled/released yet, I hope that it should be fine to update this without changing the l10n-id.
2022-06-29 11:40:54 +02:00
Jonas Jenwald
f3ba02bc00 [editor] Remove the unused name-property from the editorParamsToolbars DOM elements
As far as I can tell, this is completely unused and can thus be removed.
2022-06-29 11:40:54 +02:00
Jonas Jenwald
4a4c6b9851 [editor] Introduce a proper annotationEditorMode option/preference (PR 15075 follow-up)
This replaces the boolean `annotationEditorEnabled` option/preference with a "proper" `annotationEditorMode` one. This way it's not only possible for the user to control if Editing is enabled/disabled, but also which *specific* Editing-mode should become enabled upon PDF document load.

Given that Editing is not enabled/released yet, I cannot imagine that changing the name and type of the option/preference should be an issue.
2022-06-29 11:35:58 +02:00
Jonas Jenwald
f1d4015508
Merge pull request #15039 from calixteman/params
[editor] Add some UI elements in order to set font size & color, and ink thickness & color
2022-06-28 13:25:04 +02:00
Calixte Denizet
1a3ef2a0aa [editor] Add some UI elements in order to set font size & color, and ink thickness & color 2022-06-28 12:05:04 +02:00
Jonas Jenwald
4e025e1f08
Merge pull request #15105 from calixteman/15094
Always flush the current item with MarkedContent stuff when getting text (#15094)
2022-06-25 18:24:33 +02:00
Jonas Jenwald
f208107276
Merge pull request #15104 from timvandermeij/updates
Update translations and dependencies to the most recent versions
2022-06-25 17:50:17 +02:00
Calixte Denizet
3789dab307 Always flush the current item with MarkedContent stuff when getting text (#15094) 2022-06-25 17:19:57 +02:00
Tim van der Meij
38daef065a
Update dependencies to the most recent versions
Note that even though Puppeteer got a major version bump the changelog
doesn't include compatibility changes that are relevant to us; please
see https://github.com/puppeteer/puppeteer/releases.
2022-06-25 16:28:44 +02:00
calixteman
23fcdabb37
Merge pull request #15088 from calixteman/editor_rotation
Support rotating editor layer
2022-06-25 16:18:07 +02:00
Tim van der Meij
f7d69aab15
Update translations to the most recent versions 2022-06-25 15:45:55 +02:00
Tim van der Meij
def1a30d3e
Merge pull request #15103 from timvandermeij/permissions
chore: Set permissions for GitHub actions
2022-06-25 15:39:19 +02:00
neilnaveen
83ecc3f46c
chore: Set permissions for GitHub actions
Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much.

- Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions

https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs

[Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)

Signed-off-by: neilnaveen <42328488+neilnaveen@users.noreply.github.com>
2022-06-25 15:32:33 +02:00
Tim van der Meij
8403bafbfc
Merge pull request #15100 from turrisxyz/Dependabot-GitHub-Actions
chore: Included githubactions in the dependabot config
2022-06-25 15:18:11 +02:00
Tim van der Meij
f93ab76fa8
Merge pull request #15099 from Snuffleupagus/layers-rm-id
Remove element `id`s from the layersView in the sidebar
2022-06-25 14:58:18 +02:00
Tim van der Meij
b8a7cf7aed
Merge pull request #15101 from Snuffleupagus/browsertest-use-viewer-css
Use the *built* `components/pdf_viewer.css` file in the reference tests
2022-06-25 14:53:04 +02:00
Jonas Jenwald
c0f65657a2 Use the *built* components/pdf_viewer.css file in the reference tests
Currently we're loading the `web/annotation_layer_builder.css` and `web/xfa_layer_builder.css` files *directly* during the reference tests.
This becomes a problem is we want to reduce duplication in the CSS-files, e.g. by placing *common* rules in the `web/pdf_viewer.css` file.

Given that `gulp components` is already being utilized when running tests, we can thus use that to instead depend on the *entire* viewer-components CSS-file in the reference tests.
2022-06-25 09:54:05 +02:00
naveen
12c76d35a5 chore: Included githubactions in the dependabot config
This should help with keeping the GitHub actions updated on new releases. This will also help with keeping it secure.

Dependabot helps in keeping the supply chain secure https://docs.github.com/en/code-security/dependabot

GitHub actions up to date https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot

https://github.com/ossf/scorecard/blob/main/docs/checks.md#dependency-update-tool
Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
2022-06-25 01:30:04 +00:00
Jonas Jenwald
9748d3eb85 Remove element ids from the layersView in the sidebar
Similar to other recent patches, see e.g. PR 15057, we don't want to add these kind of `id`s to DOM-elements since they shouldn't become "linkable" through the URL hash.

*Please note:* This patch can be tested, in the viewer, with e.g. `bug1737260.pdf` from the test-suite.
2022-06-24 20:15:46 +02:00
Calixte Denizet
0c420f5135 Support rotating editor layer
- As in the annotation layer, use percent instead of pixels as unit;
- handle the rotation of the editor layer in allowing editing when rotation
  angle is not zero;
- the different editors are rotated counterclockwise in order to be usable
  when the main page is itself rotated;
- add support for saving/printing rotated editors.
2022-06-24 20:02:32 +02:00
Jonas Jenwald
cd35b9bfac
Merge pull request #15095 from Snuffleupagus/Annotation-OC
Add (basic) support for Optional Content in Annotations
2022-06-24 19:10:11 +02:00
Jonas Jenwald
8b8b4e0e6e
Merge pull request #15097 from calixteman/ut_fu
Fix unit test (#15093 follow-up)
2022-06-24 19:08:18 +02:00
Calixte Denizet
6e46226cd7 Fix unit test (#15093 follow-up) 2022-06-24 18:55:35 +02:00
calixteman
b5fea8ff14
Merge pull request #15093 from calixteman/issue15092
[JS] Update siblings when a field is updated after a calculation (#15092)
2022-06-24 16:17:59 +02:00
Jonas Jenwald
c48dc251e0 Add (basic) support for Optional Content in Annotations
Given that Annotations can also have an `OC`-entry, we need to take that into account when generating their operatorLists.

Note that in order to simplify the patch the `getOperatorList`-methods, for the Annotation-classes, were converted to be `async`.
2022-06-24 15:19:56 +02:00
Calixte Denizet
a334a21a1d [JS] Update siblings when a field is updated after a calculation (#15092) 2022-06-24 14:23:06 +02:00
Jonas Jenwald
3fab4af949
Merge pull request #15043 from Snuffleupagus/PrintAnnotationStorage
[api-minor] Introduce a `PrintAnnotationStorage` with *frozen* serializable data
2022-06-24 09:30:07 +02:00
calixteman
eace7e4c63
Merge pull request #15089 from calixteman/editor_overlap
Correctly order added annotations when saving or printing
2022-06-23 18:29:27 +02:00
Calixte Denizet
e49d039853 Correctly order added annotations when saving or printing
- the annotations must be rendered in the same order as the chronological one.
- fix a bug in document.js which avoids to read a saved pdf correctly in Acrobat:
  there is no need to reset the xref state: it's done in worker.js once everything
  has been saved.
2022-06-23 17:39:12 +02:00
Jonas Jenwald
1cc7cecc7b [api-minor] Introduce a PrintAnnotationStorage with *frozen* serializable data
Given that printing is triggered *synchronously* in browsers, it's thus possible for scripting (in PDF documents) to modify the Annotation-data while printing is currently ongoing.
To work-around that we add a new printing-specific `AnnotationStorage`, where the serializable data is *frozen* upon initialization, which the viewer can thus create/utilize during printing.
2022-06-23 17:06:46 +02:00
calixteman
c5dc082da4
Merge pull request #15082 from calixteman/print_freetext
[Editor] Add support for printing newly added FreeText annotations
2022-06-22 16:19:42 +02:00
Calixte Denizet
30c63eb0ec [Editor] Add support for printing newly added FreeText annotations 2022-06-22 13:26:09 +02:00
Jonas Jenwald
d72a85fa46
Merge pull request #15081 from Snuffleupagus/typedef-import-IPDFXfaLayerFactory
Fix (obvious) typo in typedef-import of `IPDFXfaLayerFactory` (PR 14373 follow-up)
2022-06-22 11:15:23 +02:00
Jonas Jenwald
d7c9a0a793 Fix (obvious) typo in typedef-import of IPDFXfaLayerFactory (PR 14373 follow-up)
This only affects the viewer-components TypeScript definitions, and not any actual code.
2022-06-22 11:06:11 +02:00
Jonas Jenwald
eca939d904
Merge pull request #15076 from Snuffleupagus/prefer-array-index-of
Enable the `prefer-array-index-of` ESLint plugin rule
2022-06-21 18:57:51 +02:00
calixteman
c7a18bd773
Merge pull request #15047 from calixteman/editor_printing
[Editor] Add support for printing newly added Ink annotations
2022-06-21 18:33:13 +02:00
Calixte Denizet
f27c8c4471 [Editor] Add support for printing newly added Ink annotations 2022-06-21 18:21:49 +02:00
calixteman
8d466f5dac
Merge pull request #15060 from calixteman/annotation_rotation
Rotate annotations based on the MK::R value (bug 1675139)
2022-06-21 18:03:09 +02:00
Calixte Denizet
cdc58b7a52 Rotate annotations based on the MK::R value (bug 1675139)
- it aims to fix: https://bugzilla.mozilla.org/show_bug.cgi?id=1675139;
- An annotation can be rotated (counterclockwise);
- the rotation can be set in using JS.
2022-06-21 17:57:26 +02:00
Jonas Jenwald
1c9a702f73 Enable the prefer-array-index-of ESLint plugin rule
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-index-of.md
2022-06-21 16:54:32 +02:00
Jonas Jenwald
05cab5c17d
Merge pull request #15075 from Snuffleupagus/issue-15049
[editor] Support disabling of editing when `pdfjs.enablePermissions` is set (issue 15049)
2022-06-21 15:59:39 +02:00
Jonas Jenwald
db6f675baa
Merge pull request #15069 from Snuffleupagus/annotationLayer-dimensions
Ensure that the annotationLayer has the correct dimensions (PR 15036 follow-up)
2022-06-21 15:57:21 +02:00
Jonas Jenwald
35a6a508ee [editor] Support disabling of editing when pdfjs.enablePermissions is set (issue 15049)
For encrypted PDF documents without the required permissions set, this patch adds support for disabling of Annotation-editing. However, please note that it also requires that the `pdfjs.enablePermissions` preference is set to `true` (since PDF document permissions could be seen as user hostile).[1]

As I started looking at the issue, it soon became clear that *only* trying to fix the issue without slightly re-factor the surrounding code would be somewhat difficult.
The following is an overview of the changes in this patch; sorry about the size/scope of this!

 - Use a new `AnnotationEditorUIManager`-instance *for each* PDF document opened in the GENERIC viewer, to prevent user-added Annotations from "leaking" from one document into the next.

 - Re-factor the `BaseViewer.#initializePermissions`-method, to simplify handling of temporarily disabled modes (e.g. for both Annotation-rendering and Annotation-editing).

 - When editing is enabled, let the Editor-buttons be `disabled` until the document has loaded. This way we avoid the buttons becoming clickable temporarily, for PDF documents that use permissions.

 - Slightly re-factor how the Editor-buttons are shown/hidden in the viewer, and reset the toolbar-state when a new PDF document is opened.

 - Flip the order of the Editor-buttons and the pre-exising toolbarButtons in the "toolbarViewerRight"-div. (To help reduce the size, a little bit, for the PR that adds new Editor-toolbars.)

 - Enable editing by default in the development viewer, i.e. `gulp server`, since having to (repeatedly) do that manually becomes annoying after a while.

 - Finally, support disabling of editing when `pdfjs.enablePermissions` is set; fixes issue 15049.

---

[1] Either manually with `about:config`, or using e.g. a [Group Policy](https://github.com/mozilla/policy-templates).
2022-06-21 11:54:09 +02:00