-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
[api-minor] Add support for toggling of Optional Content in the viewer (issue 12096) #12170
[api-minor] Add support for toggling of Optional Content in the viewer (issue 12096) #12170
Conversation
f2bd346
to
1d19b74
Compare
7bbe338
to
40e792e
Compare
7136336
to
4125dac
Compare
3b2fd88
to
d5b1668
Compare
d7bce24
to
ddb0abf
Compare
Rebased to |
…unning the reference test-suite This avoids the need to make a round-trip to the worker-thread for *every* single page that's being tested, which should thus be more efficient.
…ontent configuration The `/Order` array is used to improve the display of Optional Content groups in PDF viewers, and it allows a PDF document to e.g. specify that Optional Content groups should be displayed as a (collapsable) tree-structure rather than as just a list. Note that not all available Optional Content groups must be present in the `/Order` array, and PDF viewers will often (by default) hide those toggles in the UI. To allow us to improve the UX around toggling of Optional Content groups, in the default viewer, these hidden-by-default groups are thus appended to the parsed `/Order` array under a *custom* nesting level (with `name == null`). Finally, the patch also slightly tweaks an `OptionalContentConfig` related JSDoc-comment in the API.
…r (issue 12096) *Besides, obviously, adding viewer support:* This patch attempts to improve the general API for Optional Content Groups slightly, by adding a couple of new methods for interacting with the (more complex) data structures of `OptionalContentConfig`-instances. (Thus allowing us to mark some of the data as "private", given that it probably shouldn't be manipulated directly.) By utilizing not just the "raw" Optional Content Groups, but the data from the `/Order` array when available, we can thus display the Layers in a proper tree-structure with collapsible headings for PDF documents that utilizes that feature. Note that it's possible to reset all Optional Content Groups to their default visibility state, simply by double-clicking on the Layers-button in the sidebar. (Currently that's indicated in the Layers-button tooltip, which is obviously easy to overlook, however it's probably the best we can do for now without adding more buttons, or even a dropdown-toolbar, to the sidebar.) Also, the current Layers-button icons are a little rough around the edges, quite literally, but given that the viewer will soon have its UI modernized anyway they hopefully suffice in the meantime. To give users *full* control of the visibility of the various Optional Content Groups, even those which according to the `/Order` array should not (by default) be toggleable in the UI, this patch will place those under a *custom* heading which: - Is collapsed by default, and placed at the bottom of the Layers-tree, to be a bit less obtrusive. - Uses a slightly different formatting, compared to the "regular" headings. - Is localizable. Finally, note that the thumbnails are *purposely* always rendered with all Optional Content Groups at their default visibility state, since that seems the most useful and it's also consistent with other viewers. To ensure that this works as intended, we'll thus disable the `PDFThumbnailView.setImage` functionality when the Optional Content Groups have been changed in the viewer. (This obviously means that we'll re-render thumbnails instead of using the rendered pages. However, this situation ought to be rare enough for this to not really be a problem.)
ddb0abf
to
66aabe3
Compare
/botio-linux preview |
From: Bot.io (Linux m4)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/e75ae12bb3f1a9a/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/e75ae12bb3f1a9a/output.txt Total script time: 3.52 mins Published |
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://54.215.176.217:8877/8ea2eea647222b8/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/639b748863f495a/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/639b748863f495a/output.txt Total script time: 27.09 mins
Image differences available at: http://54.67.70.0:8877/639b748863f495a/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.215.176.217:8877/8ea2eea647222b8/output.txt Total script time: 29.91 mins
Image differences available at: http://54.215.176.217:8877/8ea2eea647222b8/reftest-analyzer.html#web=eq.log |
Let's do this. Awesome work! |
Thanks for the reviews here! Slightly unrelated, but should we perhaps create a new release now? I'd also very much suggest that we officially note the next release as the last one with IE 11/Edge (Trident-based) support, to allow moving forward with some much needed clean-up/improvements. |
SGTM |
Thanks for the great work here guys! |
Good idea. We're now at a point where the functionality has landed and the bugs from testing have been fixed. I'll make the release today. |
Thank you for doing this! Just one question here: How about IE 11, couldn't we have explicitly marked the new release as the last one with IE 11 support!? One example of an IE 11 issue that impacts the Firefox built-in PDF Viewer negatively is the need to ship separate toolbar images for the light/dark themes, thus effectively doubling the size of the image resources for no good reason except for IE 11 support. |
I forgot to add that while making the release. I'm not sure what happens if we edit a pre-release on GitHub, if the hooks are re-triggered or not. I'll add this as a question to the NPM issue. |
Good point; in the meantime though updating https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support to list IE 11/Edge (Trident-based) as unsupported after However, looking at that list it does seem pretty out-of-date in general and it could probably do with some clean-up. Keeping that list even remotely current is (and has been) difficult since we cannot really test all of the mentioned configurations, hence I wonder if there's perhaps a better way to handle things!?
It might be more appropriate to discuss this further in a separate issue, but the above is one idea that attempt to limited the maintenance burden of the list. |
I have updated the wiki and added the online demo idea to #11954 which I think is related since I think the required browser features page is in the same way out of date. |
Please note: Currently blocked by PRs #12163 and #12169 landing first.Fixes #12096