1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 07:08:08 +02:00
Commit graph

19408 commits

Author SHA1 Message Date
calixteman
18284815e7
Merge pull request #18570 from calixteman/new_alt_text_string_change
[Editor] Update the disclaimer string in the new alt-text dialog (bug 1911738)
2024-08-06 14:09:11 +02:00
Calixte Denizet
fc602c65c0 [Editor] Update the disclaimer string in the new alt-text dialog (bug 1911738)
And tweak the css in order to take into account that disclaimer can be on two (or more lines).
2024-08-06 10:17:18 +02:00
Tim van der Meij
9ac05e797c
Merge pull request #18560 from Snuffleupagus/editor-bind-event-handlers
Define a few editor event handler functions inline
2024-08-05 18:34:36 +02:00
Tim van der Meij
7c896578c2
Merge pull request #18555 from timvandermeij/waitforevent
Use the `waitForEvent` helper function in the text layer integration tests
2024-08-05 18:23:56 +02:00
Tim van der Meij
9844ce01b3
Merge pull request #18554 from timvandermeij/updates
Update dependencies to the most recent versions
2024-08-05 18:19:11 +02:00
Jonas Jenwald
d32b294a60
Merge pull request #18562 from nicolo-ribaudo/babel-static-block
Update the Babel plugin to remove empty static blocks
2024-08-05 16:19:25 +02:00
Nicolò Ribaudo
995f5a29aa
Update the Babel plugin to remove empty static blocks
This commit updates the Babel plugin to:
- apply the same flattening logic that we already
  have for blocks, to flatten blocks nested inside
  class static blocks
- remove class static blocks when, after flattening
  all the blocks they contain, they are empty.

Before this commit, the transform output was the
same as the input.
2024-08-05 15:14:05 +02:00
Jonas Jenwald
0eac5e9d6f Define a few editor event handler functions inline
Given that we're removing event listeners with `AbortSignal` it's no longer necessary to keep a reference to a few of the event handler functions in order to remove them.
Hence we can simply inline the relevant `bind`-calls instead, which reduces the code-size a tiny bit.
2024-08-05 12:27:53 +02:00
Tim van der Meij
356d54175b
Use the waitForEvent helper function in the text layer integration tests
The `waitForClick` helper function is functionality-wise mostly a
reduced copy of the more generic `waitForEvent` helper function that
we use for other integration tests, so we can safely replace it to
reduce the amount of code.

Moreover, the `waitForClick` code is prone to intermittent failures
given recent assertion failures we have seen on the bots (one of them
is linked in #18396) while `waitForEvent` has recently been fixed to
avoid intermittent failures, so usiong it should also get rid of the
flakiness for these integration tests.
2024-08-04 20:14:43 +02:00
Tim van der Meij
f7d2145782
Upgrade postcss-nesting to version 13.0.0
This is a major version bump, but the changelog at
https://github.com/csstools/postcss-plugins/blob/main/plugins/postcss-nesting/CHANGELOG.md
doesn't indicate any breaking changes that should impact us.
2024-08-04 19:24:43 +02:00
Tim van der Meij
1dfdb59f0b
Upgrade postcss-dir-pseudo-class to version 9.0.0
This is a major version bump, but the changelog at
https://github.com/csstools/postcss-plugins/blob/main/plugins/postcss-dir-pseudo-class/CHANGELOG.md
doesn't indicate any breaking changes that should impact us.
2024-08-04 19:23:10 +02:00
Tim van der Meij
762b16c08a
Update dependencies to the most recent versions 2024-08-04 19:20:36 +02:00
calixteman
c60c0d1c6d
Merge pull request #18552 from calixteman/issue18536
Empty fields are 0 when using AFSimple_Calculate
2024-08-03 15:10:22 +02:00
Calixte Denizet
4b7f9a8d87 Empty fields are 0 when using AFSimple_Calculate
It fixes #18536 and #18532.
2024-08-02 21:51:27 +02:00
Jonas Jenwald
829c9f553d
Merge pull request #18551 from Snuffleupagus/rm-viewer-download-options
Stop sending the unused `options` parameter to various download-methods in the viewer
2024-08-02 21:10:10 +02:00
Jonas Jenwald
ecbd660609 Stop sending the unused options parameter to various download-methods in the viewer
The `options` handling, for the download-methods, was originally added in PR 16391 and became obsolete in PR 17771.

This fixes failures, in mozilla-central tests, which appeared after landing PR 18527.
2024-08-02 20:46:13 +02:00
calixteman
a372bf8f4d
Merge pull request #18541 from calixteman/use_ml_but_no_dialog
[Editor] Guess alt text even when showing the dialog is disabled
2024-08-02 18:02:53 +02:00
Tim van der Meij
7ac87dd6f8
Merge pull request #18544 from Snuffleupagus/app-bind-listeners
Improve the larger event listeners in the `web/app.js` file
2024-08-02 17:56:19 +02:00
Calixte Denizet
d2c519e57a Guess alt text even when showing the dialog is disabled 2024-08-02 17:40:10 +02:00
calixteman
c8ba7b02b0
Merge pull request #18546 from calixteman/load_model_switch_stamp
[Editor] Load the model when the user switch to the stamp editing mode
2024-08-02 17:21:26 +02:00
Calixte Denizet
a81b071d2d [Editor] Load the model when the user switch to the stamp editing mode 2024-08-02 17:14:09 +02:00
Jonas Jenwald
aae223f79b Replace onScrollModeChanged and onSpreadModeChanged with one function
Given that these event handlers are virtually identical, obviously with the exception of the name-parameter, let's reduce a little bit of code duplication.
2024-08-02 16:16:25 +02:00
Jonas Jenwald
22ec252193 Improve the larger event listeners in the web/app.js file
- Shorten the names of the event listeners.

 - Use `bind` to pass in the `PDFViewerApplication`-scope to the event handlers.
   This makes the event handler code (a lot) less verbose, and this change is possible now that we're removing event listeners with `AbortSignal`.

 - Move the GENERIC-only event listeners into the same pre-processor block.

*Note:* This patch reduces the size of the `gulp mozcentral` output by `~4.3` kilo-bytes, which isn't a lot but still cannot hurt.
2024-08-02 16:16:25 +02:00
Tim van der Meij
b80e552760
Merge pull request #18527 from Snuffleupagus/app-inline-short-listeners
Inline single-line event handlers in the `web/app.js` file
2024-08-02 16:08:45 +02:00
Tim van der Meij
5e052af3f6
Merge pull request #18542 from Snuffleupagus/bug-report-browser-description
Link to the list of supported browsers in the bug report template
2024-08-02 15:55:26 +02:00
Tim van der Meij
0d44e71b95
Merge pull request #18547 from calixteman/fix_hcm_button_colors
Fix the color of the buttons in a dialog in HCM
2024-08-02 15:53:58 +02:00
Calixte Denizet
f32d19de18 Fix the color of the buttons in a dialog in HCM 2024-08-02 15:38:55 +02:00
calixteman
08821a3e5d
Merge pull request #18543 from calixteman/disable_create_alttext_button
[Editor] Avoid to have the create alt-text button without a click listener
2024-08-02 15:06:05 +02:00
Jonas Jenwald
464d534961
Merge pull request #18540 from calixteman/no_ml_settings
[Editor] Don't create the image settings dialog if new alt-text is disabled
2024-08-02 12:14:12 +02:00
Calixte Denizet
271bd4d079 [Editor] Avoid to have the create alt-text button without a click listener
The toggle button hasn't a click listener after we deleted and downloaded the model.
2024-08-02 11:05:58 +02:00
Calixte Denizet
974911f24f [Editor] Don't create the image settings dialog if new alt-text is disabled 2024-08-02 10:41:34 +02:00
Jonas Jenwald
adb6548d38 Link to the list of supported browsers in the bug report template
Given that users fairly often report issues with unsupported browsers/environments it cannot hurt to provide a link to the relevant section in the FAQ.
2024-08-02 10:40:50 +02:00
calixteman
4422e6fb3b
Merge pull request #18538 from calixteman/fix_new_alt_text_l10n
[Editor] Fix l10n issues
2024-08-02 10:39:08 +02:00
Calixte Denizet
63d0fa5733 [Editor] Fix l10n issues
Remove the strings containing only a variable.
2024-08-02 10:36:18 +02:00
calixteman
a7768a30b8
Merge pull request #18539 from calixteman/use_css_var
[Editor] Use the color defined for the message bar foreground
2024-08-02 10:32:54 +02:00
Calixte Denizet
1a8bcdb2ba [Editor] Use the color defined for the message bar foreground 2024-08-02 09:35:21 +02:00
Jonas Jenwald
89f3a26c2f Inline single-line event handlers in the web/app.js file
We have a fair number of (effectively) single-line event handlers in the  `web/app.js` file, which leads to unnecessarily verbose code. These can, without affecting readability too much, be replaced either by:
 - Using `bind` for the simplest cases.
 - Using arrow-functions for the remaining ones.

Note that this is possible since we started removing event listeners with `AbortSignal`, which means that we no longer need to keep a reference to the event handler functions to be able to remove them.

Given that the old event handler functions use fairly long function names, and the way that they access `PDFViewerApplication` (given their scope), they impact the overall code-size unnecessarily.
*Note:* This patch reduces the size of the `gulp mozcentral` output by `~3.7` kilo-bytes, which isn't a lot but still cannot hurt.
2024-08-01 22:02:55 +02:00
calixteman
501da85222
Merge pull request #18537 from calixteman/image_settings
[Editor] Add a new dialog for alt-text settings (bug 1909604)
2024-08-01 21:55:41 +02:00
Calixte Denizet
32d09276f0 [Editor] Add a new dialog for alt-text settings (bug 1909604)
This patch adds a new entry in the secondary menu in order to open a dialog to let the user:
 - disables the alt-text generation thanks to a ML model;
 - deletes the alt-text model downloaded in Firefox;
 - disabled the new alt-text flow.
2024-08-01 21:34:50 +02:00
Tim van der Meij
d562e0525d
Merge pull request #18523 from Snuffleupagus/Toolbar-more-bindListeners
Move all event listeners into `Toolbar.prototype.#bindListeners`
2024-08-01 20:41:32 +02:00
Tim van der Meij
e6bb1f324b
Merge pull request #18535 from Snuffleupagus/bug-report-PDF-description
Further emphasize the importance of `Attach (recommended) or Link to PDF file` in the bug report template
2024-08-01 20:07:59 +02:00
Tim van der Meij
0269cf5b4d
Merge pull request #18518 from timvandermeij/viewer-toolbar-height
Introduce a CSS variable for the toolbar height (bug 1171799)
2024-08-01 20:06:43 +02:00
Tim van der Meij
ec0f0f3d9b
Merge pull request #18517 from timvandermeij/viewer-button-types
Give all HTML button elements a type
2024-08-01 20:06:23 +02:00
Jonas Jenwald
12c3f251a1 Further emphasize the importance of Attach (recommended) or Link to PDF file in the bug report template
Unfortunately it turns out (perhaps unsurprisingly) that even the new bug report template isn't stopping users from leaving out the single most important part, i.e. `Attach (recommended) or Link to PDF file`, despite it now being marked as a required field.
2024-08-01 12:01:39 +02:00
calixteman
63371eaed8
Merge pull request #18526 from calixteman/bug1907958
[Editor] Allow Float32Array for quadpoints in annotations (bug 1907958)
2024-07-31 17:34:19 +02:00
Calixte Denizet
5f95d9b1ba [Editor] Allow Float32Array for quadpoints in annotations (bug 1907958)
Added annotations could have some quadpoints (highlight, ink).
The isNumberArray check was returning false and consequently the annotation wasn't
printable.
The tests didn't catch this issue because the quadpoints were passed as Array.
So driver.js has been updated in order to pass them as Float32Array in order
to be in a situation similar to the real life one.
2024-07-31 16:23:01 +02:00
Jonas Jenwald
7c3aa9445c Move all event listeners into Toolbar.prototype.#bindListeners
Over time a couple of event listeners have been placed in the constructor, despite there being an existing helper method for that purpose. To improve the code organization, let's move these to the intended method instead.
2024-07-31 09:49:25 +02:00
Tim van der Meij
e3838c1c70
Introduce a CSS variable for the toolbar height (bug 1171799)
This refactoring lays the foundation for making the toolbar height
configurable in Firefox via the `browser.uidensity` preference. For
this to work correctly the toolbar height must be defined in a single
place that can easily be updated dynamically, hence this patch which
moves it to a CSS variable in such a way that the rest of the UI adapts
correctly if the value is changed.

Co-authored-by: Calixte Denizet <calixte.denizet@gmail.com>
2024-07-30 21:22:49 +02:00
calixteman
f6b356eff7
Merge pull request #18516 from calixteman/add_bg_for_alpha
[Editor] Add a checkerboard behind the image preview in the new alt-text dialog in order to see its potential transparency
2024-07-30 18:53:24 +02:00
Tim van der Meij
f1f58bbe67
Give all HTML button elements a type
The HTML button elements we use are all regular buttons that don't
submit form data to a server. According to
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#notes
those buttons should all have their type set to `button` explicitly, but
we only do that a handful of them. This commit fixes the issue by
consistently giving all our buttons the `button` type.

Co-authored-by: Calixte Denizet <calixte.denizet@gmail.com>
2024-07-30 18:49:18 +02:00